IT-450 Final Project Milestone Three: Proposed Changes
In order to understand the AI in the Checkers game, we must look at how the AI is
handled when the computer makes its turn. The game uses several functions that handle what
move should be done given the exact situation where the game is at the time (more on this later).
The game uses the “movesAvailable” (see figure 1) function to generate what moves are
possible at the time and stores them in an array called “moves”. The list of moves made is simply
called “move” and is used as the basis for this array. During this process, which is called every
computer turn, the game calls another function called “moveIsValid” (see figure 2) to handle
whether the available move chosen is able to be made based on the rules of the game.
In order to effectively “pick” an available move, a function called “removeBadMoves”
(see figure 3) is implemented which appends the “moves” array with results of a “badMoves”
array which is populated with moves made throughout the game. The game determines what a
“bad” move is based on certain conditions, such as “did I gain a piece in the second turn after I
lost a piece in the last turn?” and other parameters such as this and constantly updates the
“moves” array with these decisions. This process also narrows down the available moves that
the computer has to choose between, and the move that is chosen is handled by some for loops
(see figure 4 and 5) that prioritize moves based on certain conditions.
In practice however, the AI as it is right now is very simplified as having a high tendency
to preserve itself rather than sacrificing pieces to potentially gain an advantage down the line.
The “hasMorePieces” function (see figure 6) handles this priority and is used in one of the main
for loops.
This study source was downloaded by 100000850872992 from CourseHero.com on 03-30-2023 17:37:12 GMT -05:00
https://www.coursehero.com/file/102373364/5-2-Final-Project-Milestone-Three-Proposed-Changesdocx/