Giter Site home page Giter Site logo

html5_genetic_cars's Introduction

HTML5 Genetic Cars

A genetic algorithm car evolver in HTML5 canvas.

This is inspired by BoxCar2D, and uses the same physics engine, Box2D, but it's written from scratch.

This is the code as published on http://rednuht.org/genetic_cars_2/

The current module-based format required npm and browserify.

Build with:

npm run-script build

html5_genetic_cars's People

Contributors

cutlers avatar drahakar avatar eliduvid avatar formikaio avatar formula1 avatar kbasten avatar kissiel avatar kovah avatar petah avatar red42 avatar sheershoff avatar tranzystorekk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

html5_genetic_cars's Issues

Memory leak

Hey!

The app leaks memory, and fails because of it if you leave it running for long enough.

As I saw in heap dump, a problem is with allResults property of state, that is never cleaned up from old data, and seams to contain all the cars that ever existed of something like this.

allResults: (lastState.allResults || []).concat(cw_carScores),

Peace :-)

Would you be willing to switch to TypeScript?

I noticed an issue for moving to modules. Why not make a bigger leap that includes modules?
I'd be willing to help, if not just make the conversion for you. :)

I'm asking first because it would be a waste to convert if it's not wanted.

A car suddenly got launched into the air from the beginning of the race, flying way over the end of the track

I had just let the simulation run after opening the page—all default settings. On Generation 26, one of the cars flew into the air from the start of the race and got to 2494.9, -7587.8/243.23 by the end of the generation. The viewport was not able to track it and just showed white the whole time. Obviously it got the top score by a huge margin (about 15× the second highest score), and I guess it wasn't a very well-adapted car, because the next gen started with a lot of bad cars, and they had previously been improving significantly.

The seed seems to be »9=�)�ÞPï�\õ�Ù>ø¼¬KµRa�L �Ö�ða�H�+J¹½FÓIsnónüA��¨¿zÏüÆ��F�ÂÌ#����Þfļ®�GS$�íá�ªÊ�^3]5�üó¾(�§¬[¢+ÁµþR~=ë&UO1�AÖÓ�ª\ìÌþÍ·4��bLBç¸1S J®ÚT��Ò�OUE�Wj6���ùÛ}ÇäN͹¸G9öþ�Ø�lG_�}p[&½ýB��ª×#Õ�Æ×&½#¼]um��¨×q:�ºèþöXá���pQ�¾�CQôplüs�~^]��ú�EÎlÀ§©î�yºb�ãÂöá6Éu�È�dÒ.

scores and track

floorseed

Top replay shows that the car looked like this:
flying car

Crossover in adition to mutation

Amazing idea :)
Are you planning to add crossover to the GA in addition to mutation to accelerate the fitness function optimization?
Thx

Incorrect formula for mutation size

In mutateNormal, the mutation_range is handled strangely; the resulting formula is originalValue-0.5 + random() * mutation_range (clamping omitted for clarity). The result of this is that when mutation_range is small, every mutated value is reduced to the range [0, mutation_range] within a couple of generations. A more appropriate formula would be originalValue + (random() - 0.5) * mutation_range so that the resulting distribution stays centered at originalValue when unclamped.

License?

Hello, what license have you released this code under? What are the terms that we can reuse this code under? Can you please make that explicit in the repo & files? Thank you! :-)

this is so awesome

where can i learn about

graphic library

and

about genetic programming concepts used here

i am ok with JS.

Wall-like vertical grades can be produced

The floor generator can produce artifacts like these completely insurmountable walls:

It would be nice to do a post-generation low-pass filtering pass to prevent these kinds of game-breaking obstacles from being generated.

For reference, the terrain seed I used was "TerribleTerrain" :P

Cars flying off the end of the track

Around 274 distance I'm having some of my cars fly off the end of the track

Floorseed:
"]È#Âê
Éõ¦H^��MJ�lÊ�f5RØçvdI �
~2�P×�µK��Û↵�´Õ÷Vä�¹çoË)S ¼W°§ÛDªC
�SH³8Ë1HH��ÌSѨ�a�PC\Ýgü0w�ò¨.Âß³�â���v���Ý�»aghÇPë Ù]}À±ÄÁ�X?¿g��¢ðH��«�>�©��ëY��ãæ14�%H�×úëgd�³��<H�C"BÎܱy�ã4-�!�¨§3DXÈjw�é�p85�_,àÆ¿i�Ä�5Þ[{¬×M�æ5¹Õ÷e���$�ßT�Þ}ÔÊwxÑÎp�Q�\è �YN Ó�¬øð��±Òf"

image

Purpose of 'elite' clones

Looking at the is_elite var in cawro.js, it seems the only difference elite clones have with standard ones are their color. Do they serve any other purpose?

Chose a license for the project

It would be beneficial if the author would chose a license under which this project can be used. Unless it is 'no license' on purpose.

Wheel number mutations

Have you considered adding number of wheels as a mutation or initial seed. It would be interesting to see if 1 or 3 wheel cars end up dominating the 2 wheeled cars.

A side idea, perhaps mutations involving different wheel shapes might also be worthy.

Car falls through world; goes forever

screen shot 2018-06-05 at 10 56 27 am

I had a bug in which the car fell through the world. This allowed it to make infinite forward progress as it continued to fall forever. There should probably be a sanity check for this phenomenon– for instance, if a car falls 100m below the track at that X coordinate, kill it and remove it from the selection pool.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.