InsightfulAI / neuroball

Play Pong against neural networks in this Swift Playground

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Neuroball

Neuroball is a Swift Playground, meaning you will need XCode or the Swift Playgrounds iPad app to run it.

In Neuroball, you play against a hard-coded AI opponent in a Pong-like game. However, as you play, the game will record and store your movements, which can be used to train a neural network that imitates your playstyle. You can then play against this opponent. Unfortunately, saving neural networks is currently not possible. However, you can play one of the four pre-trained networks, with the playing styles "Normal", "Aggressive", "Defensive", and "Idiot". Each style is distinctive with different difficulty levels. The "Aggressive" AI is considered the hardest while the "Idiot" AI is easy to beat - it will frequently miss the ball. I trained these AI by playing with different playstyles.

Neuroball uses its own implementation for the multi-layer perceptron models that are used to predict playstyles. Neuroball also contains its own linear algebra library which powers the neural nets; this is powered by the Accelerate framework which provides access to libraries such as BLAS which is used to compute matrix operations quickly. The code may be difficult to interpret as it was coded in 7 days with no prior Swift experience - you are welcome to document the code and submit a pull request, if you wish.

Neuroball was originally entered for WWDC Scholarships in 2019. Unfortunately, it was not accepted. Since then, Neuroball has been updated to support the iPad.

About

Play Pong against neural networks in this Swift Playground

License:Apache License 2.0