Wowzer! Actual AI with hidden layers! So not laggy you don't even need turbowarp, even on mobile! (although you may use turbowarp for hq pen: https://turbowarp.org/1104914400?hqpen ) This is an 8-braincelled AI that learns to play pong. (however the AI won't always use all of them) Use Turbo Mode for faster training. Sometimes the NN is broken, please don't tell me, I am aware this, and I don't know how to fix this. Here's how it works: This AI has 3 inputs: - Direction of the ball, - X position of the ball relative to the AI and - Y position of the ball relative to the AI. This information is passed to the hidden neurons in the neural network, which change the number according to the weights and biases. Weights multiply an input by the special weight number and pass it on to a neuron, and biases add up all the inputs going into the number as well as a static value unique to the neuron. Eventually, the calculations go down to the last neuron: the output neuron. This neuron outputs the speed of which the AI should move on the y-axis. If just one AI randomly adds, removes or modifies a neuron every time it loses, it's not going to get anywhere. That's why there's 6 AIs in one generation. However, even with 6 AIs, we're still not getting anywhere. This is where reward functions come in. Reward Function: - small reward to being close to the ball, - large reward for hitting the ball, - large punishment for touching the edge and - large punishment for being far away from the ball. With this, we can assign each neural network a score, or fitness value, which is based off how well it performed. Once each AI has performed, the best two are selected and randomly mutate. The new AIs are going to compete in the next generation. That's how the AI works.