logo

The Connect Four Game - Single Player Version

   

Added on  2023-06-15

10 Pages694 Words270 Views
 | 
 | 
 | 
Running head: THE CONNECT FOUR GAME
The Connect Four Game
Name of the student:
Name of the University:
Author note:
The Connect Four Game - Single Player Version_1

1
THE CONNECT FOUR GAME
Table of Contents
Abstract............................................................................................................................................2
Algorithm.........................................................................................................................................2
Min-Max Algorithm....................................................................................................................2
Screenshots..................................................................................................................................3
Conclusion.......................................................................................................................................6
The Connect Four Game - Single Player Version_2

2
THE CONNECT FOUR GAME
Single Player
Abstract
The Connect Four Game has both single player and double player version. In the single
player version, the computer uses the Min-Max algorithm to judge a column to play its turn. The
user is given the choice to select who goes first.
Algorithm
Min-Max Algorithm
In the single player version of the game, the computer uses Min-Max algorithm coded
with the NegaMax approach to make a move. The Negamax search is a type of MinMax search
algorithm, which depends on the zero-sum property of a double player game. The algorithm
identifies the max(x,y) function as –min(-x,-y), thus to simplify the searching approach. This
simplifies the minmax coding by requiring that X selects the move with maximum successor
value and Y selects the minimum value successor.
The evaluation feature is achieved by constantly updating the variable to count the value
of the chances present. With every possible move for the computer, the ‘eval’ variable is
incremented and vice versa with encountering users move. Finally, this variable is used in a
mathematical function to determine the move of the computer.
Finally, the winCheck function of the program evaluates every possible nodes in the
board that can possibly lead to a victory. If there is none such moves, the wincheck function
returns 0 to denote that the winning state or the tie state has not yet been reached. The function
finally makes sure, whether 42 moves, that is the total number of cells in the board has already
been filled. In this case, 3 is returned to denote a Tie state and the program ends. Furthermore, if
The Connect Four Game - Single Player Version_3

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents