Giter Club home page Giter Club logo

watchcarslearn's Introduction

WatchCarsLearn

watchcarslearn

Watch cars learn right in your browser! https://manassarpatwar.github.io/WatchCarsLearn/

The Car

car

  • Each car has 5 distance sensors which serve as inputs to its brain (neural network)
  • Each sensor has a max length and the input passed to the network is a normalized value of the sensor input (length/maxLength)
  • The brain of the car outputs 2 values, both between 0 and 1
  • The first value controls the throttle and brake of the car. If the value is greater than 0.66, the car accelerates else if it is less than 0.33, it brakes.
  • The second value controls the steering of the car. If the value is greater than 0.66, the car steers right, else if it is less than 0.33, it steers left.
  • The physics of the car is inspired by spacejack's implementation of Marco Monster's Car Physics for games paper

The Track

track

Procedural Track Generation

Beziers, Beziers, Beziers!

  • I used bezier.js for working with beziers
  • The track is made up of a lot of bezier curves
  • There exists a hidden path of bezier curves that runs through the middle of the track. I use this path to calculate score of each car, and check whether the car is on the track or it has crashed
  • The input sensor length is measured on every physics step. It is measured by calculating the intersection point between the sensor line and a nearest bezier curve

Editing and randomizing

  • The track is completely editable and randomizable on the fly
  • The simulation is paused while the user is editing otherwise the window will freeze up
  • To Edit, simply click on the pencil icon and drag any of the control points

Neural Network

network

Activation

  • The network is a feed forward neural network and stops any recurrent connections from being mutated
  • The network is activated using a list of nodes sorted topologically(Kahn's algorithm)

Nodes

  • Brightness of each node is the output of that node when activated

Connections

  • Connections which are green have a positive weight
  • Connections which are blue have a negative weight
  • Connections which are red are disabled

Neuro Evolution of Augmenting Topologies (NEAT)

Icons

All icons were created in p5.js web editor by me

Pencil

pencil_black
p5.js editor sketch for pencil

Randomize

random_black
p5.js editor sketch for randomize

Steering wheel

steering_black
p5.js editor sketch for steering wheel

License

MIT
Copyright (c) 2020-present Manas Sarpatwar

watchcarslearn's People

Contributors

manassarpatwar 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

Watchers

 avatar

Forkers

mrmckracken darn0

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.