Sie sind auf Seite 1von 3

Assignment 2: Description

The purpose of assignment 2 is to study the adversarial search by building computer dual games. The game chosen for this assignment is Naught and Cross Game. Naught and Cross Game:

X X O O X X X O O O X O X X O X O X O O X

Naught and Cross Game is very popular to students in Viet Nam, Korea and China. It is the extended version of Tic-Tac-Toe game. The board is a grid of 15*15 squares, where two players (Naught and Cross players) could play on. The players will make a move in turn. The Naught player will put O to an empty square as his move, while the Cross player puts X for his move. Who ever reaches 5 pieces (X or O) in a row (vertically, horizontally, or diagonally) first will win. If after 15*15 squares are filled in and no one wined then the game is draw. Assignment Requirements: Write your program to play Naught and Cross with Human. You program MUST: - Allow user to choose program or human (the user) to make the first move. - The first move by default is the center of the grid. - The player who makes the first move is X (Cross player) (regardless of being human or computer). - Check if a move is valid (into an empty square). - Be able to recognize whether a game has come to an end (there is one winner or a draw). - Ensure that no move takes longer than 5 minutes. Deadline of the Assignment: Thursday, 17/10/2013.

How will you be evaluated? If your program does not satisfy all the requirements above, your mark is 0; In Friday afternoon, 18/10/2013, we will organize a tournament where your program will play against each other. You will play against every other in two games, in one of which you will make the first move and in the other the opponent will make the first move. For one winning game, you get 1 point, 0.5 for a draw, and 0 for a lost. The top two teams will get the mark of 20 while the bottom two will only get 10. The champion team will receive a special gift from me to mark the occasion. Some hints for you: Here is a framework for the program you should implement: To make a move: If any player has won then Report and Quit; If this is a first move then If you play first then Play in the central square Else Play randomly around the central square; Else If you could win in the next move then Make the move to win Report and Quit Else If the opponent is going to win in the next move then Block the opponent move; Else If it is possible and not long to use MiniMax then Compute Next Move using MiniMax (Minimax with Alpha-Beta) Search Else Make Random Move; //making random move or booked move as default What are the next possible moves? It seems unwise to consider all 15*15 squares, since from the beginning most of them would be empty and making moves far from the center would be wasteful. Therefore, you could make the possible moves at only the empty squares that are neighbors to the occupied squares. How could we build an evaluation function? Your evaluation function could be a weighted sum of some features of the board. For each feature, you could consider your advantage over the opponent on having rows of 2pieces, 3-pieces, 4-piecies as the measurement of the goodness of the board from your points of

view. Remember that not all 2-pieces (3-pieces, 4-piecies) rows are the same degree of importance. Look at the figures follows. The 2-pieces row in the first figure must be more important than the one in the second figure, which it self should be more important than the 2pieces row in the last figure. O X X O O O O O X

Das könnte Ihnen auch gefallen