Tic Tac Toe Game in AI | with Minimax Algorithm using Java | بـالـعـربـي

Abdalla Fadl
Abdalla Fadl
1.6 هزار بار بازدید - 2 سال پیش - Tic Tac Toe with detailed
Tic Tac Toe with detailed explanation of Minimax AI Algorithm plus the implementation in java for making unbeatable AI Tic Tac Toe.

An implementation of Minimax AI Algorithm on Tic-Tac-Toe (or Noughts and Crosses) game.

Introduction

To solve games using AI, we will introduce the concept of a game tree followed by minimax algorithm. The different states of the game are represented by nodes in the game tree, very similar to the above planning problems. The idea is just slightly different. In the game tree, the nodes are arranged in levels that correspond to each player's turns in the game so that the “root” node of the tree (usually depicted at the top of the diagram) is the beginning position in the game. In tic-tac-toe, this would be the empty grid with no Xs or Os played yet. Under root, on the second level, there are the possible states that can result from the first player’s moves, be it X or O. We call these nodes the “children” of the root node.

Each node on the second level, would further have as its children nodes the states that can be reached from it by the opposing player's moves. This is continued, level by level, until reaching states where the game is over. In tic-tac-toe, this means that either one of the players gets a line of three and wins, or the board is full and the game ends in a tie.
===============================
Code on GitHub :
https://github.com/youssefgoe/TicTacT...
===============================
Time Stamps:
0:00 Intro
2:00 MiniMax Algorithm Brief Explanation
11:00 Code Explanation
2 سال پیش در تاریخ 1401/05/19 منتشر شده است.
1,665 بـار بازدید شده
... بیشتر