simone-rizzo / TicTacToeAIAgent

Invincible TicTacToe AI agent

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

An invincible AI Agent

I made this agent using the cycle:

  • Plan
  • Execute
  • Perceive

This type of games, with an enemy, are more complicated than the other and it's similar to real problems.

To resolve this kind of problems the important think is to manage them like a searching problems where:

  • States: are the configuration of the game
  • Player(s): which player should play in the state 's'
  • Result(s,a): the result state after an action
  • Terminal-Test(s): determ if the game is ended
  • Utility(s,p): utility function to evaluate the ending states of the game for the user p

Two types of algorithm solve this problem

  • Min-Max algorithm
  • Alpha-Beta algorithm

Both are implemented in the code.

Min-Max

It's very useful for simpler games, it generate all the possible configuration for the current state. Choosing the action that maximize your chance of victory and minimize the enemy one. If you want to read more MinMax.

Alpha-beta

It's similar to Min-Max algorithm but it take less time and space beacause it didn't generate all the possible permutations. Instead it cut the leaves of the permutation tree, visiting a minor number of state. If you want to read more AlphaBeta

About

Invincible TicTacToe AI agent


Languages

Language:Python 98.0%Language:Tcl 1.9%Language:PowerShell 0.0%Language:Batchfile 0.0%