How I taught a neuron in a “dinosaur” to play


One ordinary day I was browsing the Internet, suddenly they turned it off. Remembering about the old Easter egg from Google, namely about the running dinosaur on the error page. Studying machine learning and remembering the Mari / O project, I decided to do something similar, I wanted the artificial neural network to learn how to play Dinosaur on a real person level.


To achieve this goal, it was decided to use Genetic algorithms, that is, to make the dinosaurs 'Evolve'.

Genetic algorithm

So what is this genetic algorithm?

A genetic algorithm is a search algorithm used to solve optimization and modeling problems by randomly selecting, combining, and varying the desired parameters using mechanisms similar to natural selection in nature. It is a type of evolutionary computing that solves optimization problems using methods of natural evolution, such as inheritance, mutations, selection, and crossingover. A distinctive feature of the genetic algorithm is the emphasis on the use of the “crossing” operator, which performs the operation of recombination of candidate solutions, the role of which is similar to the role of crossing in wildlife.



The principle of operation of our program (as we have already said) is based on machine-based learning with reinforcement . I will try to describe the principle of work in a few words:

In each generation, several best representatives are selected. Based on them, a new one is created. Based on the various "weights" of neural connections and input information (distance to the obstacle, and its height), a decision is made about the action of a particular representative of the species.


I hope everything is clear.


As a result, our "Genetic Model" reached 332 thousand points in 219 generations.


There is potential for achieving great results.

But there is still much work to be done.

PS: Thanks for reading! By the way, we wanted to show the learning process of a neuron live. You can see it here .

Upd. Meanwhile, the program scored 942 thousand points.

Also popular now: