A chess AI game programmed using Javascript. It uses minmax algorithm(without alpha-beta pruning for now) to find the best move.
Mini-max algorithm is a recursive or backtracking algorithm which is used in decision-making and game theory. It provides an optimal move for the player assuming that opponent is also playing optimally.
Mini-Max algorithm uses recursion to search through the game-tree.This Algorithm computes the minimax decision for the current state. In this algorithm two players play the game, one is called MAX and other is called MIN. Both the players fight it as the opponent player gets the minimum benefit while they get the maximum benefit. Both Players of the game are opponent of each other, where MAX will select the maximized value and MIN will select the minimized value.
The minimax algorithm performs a depth-first search algorithm for the exploration of the complete game tree. The minimax algorithm proceeds all the way down to the terminal node of the tree, then backtrack the tree as the recursion.
Increasing value of variable "maxDepth" improves the AI's performance but is computationally expensive.
In case two or more moves get the same score, to avoid the bot from repeating the same moves, one of the candidate moves is randomly selected.