Linux Format

Build a noughts and crosses playing AI

The solution presented in this article was first inspired by the movie WarGames (1983) where strategy games such as poker, backgammon and noughts and crosses were featured in the movie that depicted AI opponents not only playing against human players but also having the ability to figure out how to beat them. The AI opponent built for this project mainly uses the minimax1 AI algorithm to help beat a human opponent. In addition, various YouTube videos were viewed for common implementation techniques and approaches already attempted by others.

The aim of this project was to create an AI player that would prove very difficult to beat for a human player even though not completely impossible. In the end, to get this projected to a reasonably completed state, various strategies were implemented so that the AI player was very difficult to beat. In addition to using the minimax algorithm, various scenarios have been considered, such as where the human player would likely start the game from and how that starting position would affect the chances

You’re reading a preview, subscribe to read more.

More from Linux Format

Linux Format4 min read
Linux
The #1 open source mag Future Publishing Limited, Quay House, The Ambury, Bath, BA1 1UA Email contact@linuxformat.com EDITORIAL Editor-in-chief Neil Mohr Art editor Fraser McDermott Production editor Katharine Davies Group editor-in-chief Graham Bar
Linux Format3 min read
Kernel Watch
Linus Torvalds announced the fourth RC (Release Candidate) for what will become Linux 6.9 in another few weeks. In his announcement, he noted that there was “Nothing particularly unusual going on this week – some new hardware mitigations may stand o
Linux Format1 min read
Sql At Fifty
Structured Query Language (SQL) is 50 years old. It is the only programming language from the ’70s that is still around and – unlike COBOL and Fortran, which are confined to limited niche roles – still thriving and expanding. In 2023, the IEEE declar

Related Books & Audiobooks