Anu26092002 / MinimaxTicTacToe

A Java GUI application for playing Tic-Tac-Toe againts the computer. The Game implements the Min-Max algorithm where the computer maximizes its chance for winning the game.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Minimax Algorithm Implemetation in Tic Tac Toe by using Java Swings


tic tac toe gif


🤖 Play a Demo Tic-Tac-Toe Game to vizualize the project with Google X and O


Made with 🧡 🤍 💚 by Anurag Ghosh


Documentation


🙃 How to play the Game

The player choice by default is 'X' and the computer's or AI Agent's choice is 'O' by default. The user can only lose or can be tied with the computer, the next move of the computer is predicted by using the minimax algorithm

The computer first prepares all the possible position of the human player to make his/her move and then chooses the most optimal position as per the minimax algorithm


The PEAS Table for this AI Agent is as followed:

Agent Performance Measure Environment Actuator Sensors
The agent is always playing as 'O' and the human player is always playing as 'X'
  • The agent can play the game
  • The agent has to place three O’s in a row or prevent three X’s from being placed in a row
  • The agent can win the game or at least tie/draw
  • The Tic Tac Toe interface or 3x3 Grid i.e blank buttons on the GUI
  • Game pieces i.e X's and O's
  • The laptop/computer
  • The Human Player
  • The mouse clicks on laptop/computer
The Human Player's Moves

The classification of the Tic-Tac-Toe task Environment is as followed:

  • Fully observable: Nothing is hidden from the agent. The agent can see all parts of the environment at all times.
  • Deterministic: The next state of the board is completely determined by the move of the agent.
  • Sequential: Later moves will depend on what moves were taken previously.
  • Static: The game board remains constant while the agent is determining its next move.
  • Discrete: Tic-Tac-Toe has a finite state space.

About

A Java GUI application for playing Tic-Tac-Toe againts the computer. The Game implements the Min-Max algorithm where the computer maximizes its chance for winning the game.

License:MIT License


Languages

Language:Java 100.0%