Skip to content

Single/double player game featuring a computer program that uses the Minimax algorithm

Notifications You must be signed in to change notification settings

akilkarthikeyan/maxit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maxit

Maxit is usually played on an n x n grid of squares. Each square contains a value ranging from -9 to 15. One of the squares is initially designated with a marker (**) indicating the current position. Player X may take any square on the same row as the marker. When Player X is done, Player Y makes a similar move, except choosing between the squares in the column. Play alternates until all squares are taken or until a player is left without a valid move. The player with the most points at the end is the winner.

Includes two modes of play

  1. Single Player - Where the player plays against the program
  2. Double Player - Where two players play against each other

Minimax algorithm used in the single player mode to make the optimal move every time based on the state of the grid to maximize computer’s score. (Implemented via Bitmask DP)

State of the grid decided by

  1. position - Current position of the pointer
  2. gridState - Bitmask containing the positions of the grid that are not taken
  3. turn - Indicates whether the current turn is X's or Y's

DP array stores the difference between the scores of both players "Y - X".
Next move chosen to maximize "Y - X" in case of Y's turn or maximize "X - Y" in case of X's turn.
Computer assumes the role of Player Y and makes the next move per the DP array.

View deployment at https://akilkarthikeyan.github.io/maxit/

About

Single/double player game featuring a computer program that uses the Minimax algorithm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published