Coder Social home page Coder Social logo

dashersw / busy-city Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zuzaanto/busy-city

1.0 3.0 0.0 5.31 MB

A busy city simulation of citizens and scooters which can be rented. Using Google Directions API.

License: Apache License 2.0

C# 100.00%

busy-city's Introduction

busy-city

For the program to work, you need to get your own API Key from here:https://developers.google.com/maps/documentation/directions/start#get-a-key and paste it into the program.cs 84th line. You also may need to change the directory of the txt file exported, also in program.cs. The program starts by asking the user for longitude and latitude (I am not sure if I didn't mix the labels up, sorry). After typing longitude and latitude, you have to close the window of the Form. Then the longer you let the program run, the more background data it shall export to txt file. The simulation is not exactly real-time - its velocity depends on your computer's parameters, internet connection etc. For cleariness purposes, I decided to export just the citizens' status and positions in every interation of the simulation. In one iteration, a citizen moves ca. 10 meters, and a citizen on a scooter moves about 10x faster. If any issues should come up, please do contact me.

instructions:

there are 10 citizens, and 20 scooters on the square map, height=width=20km. to initialize it, please insert longitude and latitude of the center of preferred location, preferably with many streets and paths etc. then close the window. the simulation runs for 1000iterations for every citizen by default.

legend:

there are 7 cases of citizen-scooter interaction:

[cases of walking:]

1st case: citizen has no map, so he: finds the closest scooter gets the directions from google api to it makes his first move in the direction of Google's first step (walking paths are suggested by google)

2nd case: citizen knows where to go, but isn't there yet. he makes his moves and checks which google step he is on (column 3 in txt file).

3rd case: citizen is on his last step - he makes it, and then finds out that the scooter he was aiming for is already taken. he decides to find another one. he has to get new google directions for that.

4th case: citizen is on his last step - he makes it, and this time the scooter is free to take! he starts driving it, and throws away the map he was using (or the google route).

[cases of driving:]

5th case: citizen is on scooter, he has no map. He wants to go to his destination. he gets directions from google maps. he makes his first move, so does his scooter - their velocity (jump) is bigger than in walking mode. they also use driving roads, not walking paths as before. they avoid highways.

6th case: citizen is on scooter. he knows where he's going. he makes his progress, and checks the google step he is on.

7th case: citizen is finally in his destination. he leaves his scooter free to take there. his status is back to 'walking'. his map is thrown, and new destination is ordered for him (randomly). he is told to wait there 100 iterations.

busy-city's People

Contributors

dashersw avatar zuzaanto avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

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.