/tictactoe-electron

Unbeatable AI for tictactoe implemented using electron and js

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

tictactoe-electron

What is tic-tac-toe?

Tic-tac-toe or Xs and Os is a paper-and-pencil game for two players who take turns marking the spaces in a three-by-three grid with X or O. The player who succeeds in placing three of their marks in a horizontal, vertical, or diagonal row is the winner Source: Wikipedia.

An unbeatable bot for tic-tac-toe:

It's a solved game, so the only thing "reliable" is that optimal play will lead to, at best, a draw. Unless your opponent makes mistakes, and the board just isn’t complicated enough to try to force your opponent into mis-reading a complicated situation Source: Josuhua Engel on Quora. The goal of this project was to use the following map created by Randall Munroe and to put every possible state into a graph in order to create a bot you can't beat at a game of tic-tac-toe.
Complete map of optimal tic-tac-toe moves: complete map of optimal tic-tac-toe moves

Notes:

  • This game was built with ElectronJS to create a simple desktop app.
  • This project is not up to date and you should only use it as a reference.

License:

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>

License located in LICENSE.md