Simplified the neural network and made it recurrent.
Added more inputs and fixed a NaN bug.