COMP1100 Assignment_3 Report Tue13 Tutor:James Bacon u6768636
Introduction
Ataxx is played on a grid of squares with 7×7 boards and programs conduct how the relationship between legal moving and capturing.
Assumption
There is a assumption that we construct legal moves when call AI.
Program Design
The AI uses a greedy strategy with a simple scoring strategy. The detailed scoring strategy is
• If the current player wins, the score is 10,000.
• If the opponent wins, the score is -10,000.
• If the game is a draw, the score is -10,000, indicating that this situation is unacceptable.
• If the game is not over, count the number of pieces of both players, and make their difference the score.
For each legal move, calculate its score, and choose the move with the largest score.
SimpleScore
This function calculates the score for a GameSate, the calculation rules have been described.
scoreMove
This function calculates the score of a move; it constructs the first step of applying moving to the current gameState to obtain a next GameState, and then using simpleScore to calculate the score of the GameState.
allMoveAndScores
This function is to get all legal moving and their scores from the current GameState.
First call allMoveAndScores
This function is to get all legal moves and their scores. Then it gets the move with the highest score from it. This move is the final result.
Testing
The AI is divided into small functions to be easily tested individually. All functions are tested with player 1 and player 2, to make sure they work in both cases.
Reflection
When designing project, I was frustrated with minimax and I have some issues of coding redundancy. If I redesign this program I will use improved code and successfully conduct coding.