Skip to content
Watch a Neural Network learns to shoot a target
JavaScript HTML CSS
Branch: master
Clone or download
Latest commit f96cc56 Jan 5, 2020
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Create FUNDING.yml Jan 5, 2020
css first commit Jan 5, 2020
js Typo Jan 5, 2020
LICENSE Create LICENSE Jan 5, 2020
manifest.json first commit Jan 5, 2020
screenshot.png fix screenshot Jan 5, 2020

Self Taught Neural Network

Watch a Neural Network learns how to shoot a target.


Live version

Watch the video of the Neural Network learning ~ 20 minutes


Halfway through creating a clone of the classic windows game Bang Bang I realized I need a interesting Artificial Intelligence to play against the player. So I thought about having the opponent cannon be controlled by a Neural Network and learn how to shoot during run time.


I came up with this algorithm to train the Neural Network.

1 - Shoot it at random

2 - If the shot was to the left of the target, adjust the weights to the right and vice and versa. On this step I'm not saving the training data, as I don't care for a miss shot.

3 - After a hit, collect the data and use it to further train the Neural Network. This data is stored as it is a good example of how to shoot a target.  


I'm thinking about using different iterations of the trained Neural Network to use as a difficult level. Neural Networks trained for a short while would be the first opponents while the Neural Network that ware trained for a long period of time would come last, as a more hard opponent.

You can’t perform that action at this time.