This is one of the Zipline projects for FreeCodeCamp. The goal was to make an application that plays a perfect game of tictactoe meaning you can never beat it, at best you can tie with it
No codepen this time but there is a github page at http://tyrantwarship.github.io/FCC-TicTacToe-Zipline/ for the demo
The Ai uses the maxipad algorithm which I heavily learned from this source: http://www.ntu.edu.sg/home/ehchua/programming/java/JavaGame_TicTacToe_AI.html