/tic-tac-toe-game

unbeatable tictactoe game

Primary LanguageRuby

Tic Tac Toe!

You can beat each other, but you can't beat the computer. Try winning this simple game against this AI mastermind, but it's not going to happen. Or play with your friends and win. Your choice.

Give my game a shot right here!

Features

I used the minimax algorithm to implement the perfect player, and thus make it unbeatable. The algorithm uses the fact that players are working towards opposite goals to make predictions about which future states the game will reach. The theory behind minimax is that the current opponent will be always be attempting to minimize whatever value the current player (algorithm) is trying to maximize. Ergo, "minimax".


You can also clone this repo, run bundle install and rackup on your command line, and play on your localhost as well. If you play locally, you can view the game output in the terminal as well as in the browser.

Have fun!