The cool thing that I learned about neural networks during this time is that its simple linear algebra! If you consider the neurons to be a vector, all you need to do is take the dot product of the nodes and the weights, add the bias, then you get the new neurons value! I was so surprised that it was so simple, so I started to create a class, along with a mutation method so that I can mutate each weight slightly so it can learn like in Darwinian Evolution. Bellow is the neural net used for the birds. It takes in the velocity, y value of bird, y value of top and bottom of pipe, and x value of pipe! The output is 2 numbers, and if the first node is larger, it jumps. That way I don't have to implement a soft max activation.
After building the neural network, all I had to do was pop it in to the birds, so some debugging with the inputs, and it worked flawlessly! The birds were learning fast, and after a few generations, started to play the game without any mistakes!
This was amazing because I didn't think I would be able to create my very own AI from scratch, and it's amazing to see something actually make decisions with math. If you want to check out the project, take a look at https://flappyai.hacker22.repl.co or look at the GitHub at @neelr/FlappyAI.