Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums

Go Back   Code Forums > Application and Web Development > Standard C, C++

Reply
 
LinkBack Thread Tools Display Modes
Old 08-11-2004, 09:48 AM   #1 (permalink)
Nightmare
Registered User
 
Nightmare's Avatar
 
Join Date: Aug 2004
Location: Pretoria
Posts: 1
Nightmare is on a distinguished road
Please HeLp Wid A game of 3 x 3 tic-tac-toe (noughts and crosses) in C++

It is this assignment:
__________________________________________________ _
For this practical assignment you have to implement a game of 3 x 3 tic-tac-toe (noughts and crosses) where a person plays against the computer. You may choose who starts the game.
To find a winning strategy, the computer must be able to look ahead and consider all possibilities of the opponent's move in order to choose its own best move. A game tree of all possible moves is generated and some kind of evaluation function is applied to find the best move. A procedure known as the minimax procedure is used to find good moves. MAX plays against MIN . MAX's best choice is the possibility with the highest positive evaluation while MIN's best one is the possibility with the smallest (that is, the most negative) evaluation. The evaluation e(p) of a position p is given by the following rule:
If p is not a winning position for either player:
• e(p) = (number of complete rows, columns, or diagonals that are still open for MAX) - (number of complete rows, columns, or diagonals that are still open for MIN)
• If p is win for MAX: e(p) = infinity;
• If p is a win for MIN: e(p) = -infinty;
To find the best possible move for MAX (X) if it is MAX's turn to play:
• Consider all possible positions where X can be placed. (level 1)
• For each position of X, consider all possible positions where a O can be placed (level 2)
• Apply the above evaluation function to each node in level 2 and find the lowest value (best for MIN of each group). Pass that value up one level.
• Back up one level and find the highest of the lowest values in level 2.
• Let MAX's move be that possibility
The computer (MAX) now waits for the person (MIN) to play after which the whole process is repeated with the present node as the new first node until a win for MAX is found. If a win for MIN is found (-infinity) that node's children are not evaluated.

__________________________________________----_----------_---_
Nightmare is offline   Reply With Quote
Old 08-11-2004, 11:36 AM   #2 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
You're funny.
Get some work done, then come back and ask the concrete issues you don't completely understand. No one is going to build you a complete application.
__________________
Valmont is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 08:25 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting