Code 3: Auto Move

Playing against the computer requires 4 game-specific classes: Game-state, Move, Move-generator, and Move-implementer.

 

Game State

A simplified, mathematical model of the current game state. For example, a chess board (the game-state of chess) consists of an 8 x 8 matrix of integers. Zero represents an empty square, 1 = a white pawn, -1 = a black pawn, 2 = a white knight, etc.

 

Move

A simplified, mathematical model of the current move. For example, a chess move consists of 4 integers: the source row/column and the destination row/column.

 

Move Generator

Generates the optimum move.

 

Move Implementer

Carries out the move generated by Move-generator.