CodingTrain / Toy-Neural-Network-JS

Neural Network JavaScript library for Coding Train tutorials
MIT License
425 stars 242 forks source link

Several changes for smoother results and more control over the NN. #116

Open iciclesoft opened 6 years ago

iciclesoft commented 6 years ago

Changed mutation to also check if it should mutate at all based on the rate. Changed the mutation rate because of the mentioned mutation-changes. Doubled vehicle.maxforce so it has more control over itself. Changed the border-inputs according to the entire canvas instead of the 50px wide stroke. Lastly I've added a fallback for when all vehicles are about to die, which would probably never happen in the current reproduction-rate.

The mutation-changes are mainly so not every reproduced vehicle is mutated (which pretty much was the case). The vehicle.maxforce seems to have quite some impact on the results over time, setting this to an insane amount will get some 100k+ vehicles (framecount score) quite easily. The border changes were made so the vehicles don't get stuck in a corner. The fallback is quite useless now, but it would be nice if you want to change the reproduction-rate.