GithubHelp home page GithubHelp logo

Gridlocks about egregoria HOT 2 CLOSED

uriopass avatar uriopass commented on May 9, 2024
Gridlocks

from egregoria.

Comments (2)

Uriopass avatar Uriopass commented on May 9, 2024 1

I had another idea on how to tackle this.

When a car stops, it displays it's id behind it, then displays the id shown on the car that blocks it.
Then, if a car sees it's own ID, it knows there's a cycle (and therefore a gridlock) and goes into panic mode and just drives through everything for a couple of seconds.

There are many ways to make this smoother, but this is the gist, and I'm pretty sure it should work. It shouldn't have any impact on performance too.

from egregoria.

Uriopass avatar Uriopass commented on May 9, 2024

Implemented in e96cabe and it works very well :-) here's a video to show the three lock scenario being resolved and a more complicated example where lots of gridlocks appear and are resolved. (thanks github for supporting video!)

2021-01-10_13-05-15.mp4

You might probably think that the 3 grid lock is a bit disappointing because they all start at the same time and run over each other. But this is an artefact of the test since they all start stopped at the same time. In a real situation, some car will stop last and break the symmetry and only one car will start before the others.

from egregoria.

Related Issues (20)

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.