A Fight with AI in Ruby
(Many references to WarGames(1983). You have been warned.)


WarGames(1983) AI Joshua playing TicTacToe
Tic tac toe, a strange game, the only way to win against my AI is to press control + c before getting a tie. This was one of my first challenging projects with my school. My approach to building this project was a bit different than most students, basically I reversed engineered TicTacToe in order to build an unbeatable algorithm. I drew diagrams to help me visualize the logic flow of how such an AI would need to function. I went through and made notes of steps it would need to take in order to win, and also figured out how to prioritize those steps based on the state of the game. I had to make my AI think to the future and decide which move to take, a move that will not only cause it to stop the other player from winning, but immediately identify threats that would cause it to loose and ultimately pull off a win/tie.
Ultimately, I built an unbeatable AI from scratch that may or may not eventually figure out "the only winning move is not to play." This project was very challenging, especially for not having that much experience in programming, but it was a lot of fun to design, build and figure out on my own. You can find my project Github repo here.



