Skip to main content

University faculty member — Ph.D. in Artificial Intelligence and Robotics

اللّهُمَّ عَجِّلْ لِوَلِیِّکَ الْفَرَج

Interactive AI Lab

See important AI algorithms come alive and experiment with them: a genetic algorithm that evolves a solution to the N-Queens puzzle generation by generation, an algorithm that uncovers hidden groups in a social network, search algorithms that find their way out of a maze, and chess against an AI that thinks with adversarial search (minimax and alpha-beta) and shows you its thoughts. Everything runs in your browser.

thinking
thinking

You are reviewing an earlier position — press ⏭ to return to the game.

The AI's thoughts minimax.log

    Players

    Your pieces (starts a new game)

    Moves

      Evaluation over the game

      The game tree, two plies deep

      For the position on the board: every move of the side to move (MAX) and the opponent's replies (MIN). MIN takes the reply worst for MAX; MAX takes the move whose worst case is best. Alpha-beta stops looking at a move as soon as one reply shows it cannot beat a move already found.

      Minimax vs alpha-beta

      All three search the same position to the same depth. Alpha-beta always returns the minimax value — it only skips branches that cannot matter. How many positions does each one need?

      Adversarial search and game theory

      Chess is a two-player, zero-sum game with perfect information: what one side gains, the other loses, and both see everything. Von Neumann's minimax theorem (1928) says such a game has a value: MAX maximises the outcome assuming MIN replies with the move that minimises it. The minimax algorithm computes it by searching the game tree; since about 35 moves are possible in a typical position, the tree grows as 35^d and no computer can search it to the end.

      So the computer…

      …stops at a fixed depth and estimates the position with a heuristic evaluation function (material, piece placement, king safety); prunes with alpha-beta, which with perfect move ordering searches about 35^(d/2) positions instead of 35^d and so reaches twice the depth in the same time; deepens iteratively and remembers positions it has already seen (transposition table); and keeps searching captures past the horizon (quiescence) so it does not stop in the middle of an exchange. The “deliberate error” slider weakens it like a human of bounded rationality: a fixed random error in every evaluation. AI course materials