The use of machine learning to teach computers to play board games has had a lot of interest lately. Big companies such as Facebook and Google have both made recent breakthroughs in teaching AI the complex board game, Go. However, people have been using machine learning to teach computers board games since the mid-twentieth century. In the early 1960s Donald Michie, a British computer scientist who helped break the German Tunny code during the Second World War, came up with Menace (the Machine Educable Noughts And Crosses Engine). Menace uses 304 matchboxes all filled with coloured beads in order to learn to play noughts and crosses.
The dataset, available here, is a collection of 958 possible tac-tac-toe end-of-game board configurations, with 9 variables representing the 9 squares of a tic-tac-toe board, and a tenth class variable which designates if the described board configuration is a winning (positive) or not (negative) ending configuration for player X. On the unseen test set, the neural network correctly predicted the class of 180 of the 186 instances. By using different optimizers (as opposed to Adam), a well as changing the number of hidden layers and the number of neurons per hidden layer, the resulting trained networks did not result in better loss, accuracy, or correctly classified test instances beyond what is reported above. I hope this has been a useful introduction to constructing neural networks with Keras.
In a previous post, I shared how to build a randomised Tic Tac Toe simulation. The computer plays against itself playing at random positions. In this post, I will share how to teach the computer to play the game strategically. I love the 1983 classic movie War Games. In this film, a computer plays Tic Tac Toe against itself to learn that it cannot win the game to prevent a nuclear war.
As a developer, you determine which things change, and SpriteKit handles the work involved with displaying those changes. During the project creation, Xcode creates a SKScene file that represents your initial view for your game along with a view controller file that initializes your game scene and handles presenting on screen when you launch the app. The center of the view is the scene display, and the yellow outline around our tic tac toe board represents our view port that is visible for our game. This method handles our user touches for selecting our moves and reseting the game.
McKinsey analysts recently asked how traditional industries are now using machine learning to gather fresh business insights. With processing power so cheap, chewing through petabytes of data in order for machine learning to happen is no longer an activity restricted to science boffins or the cash-rich. By digitizing the past few seasons' games, it has created predictive models that allow a coach to distinguish between, as CEO Rajiv Maheswaran puts it, "a bad shooter who takes good shots and a good shooter who takes bad shots"--and to adjust his decisions accordingly". Colin Parris, the vice president of software research at GE Software reckons his company will "gain through machine learning the same sharpness of insight into the individual vagaries of a jet engine that Google has into the online behavior of a 24-year-old netizen from West Hollywood".