Skip to main content

A Traffic Light Simulator

Project description

Traffic Light Simulator Goals

This is an attempt to simulate a simple traffic light. You can specify how long you want each light show before it changes to the next light, as well as the number of cycles (green to red or red to green light changes) you want before the simulator stops running.

Install

Install with pip

You may want to do this in a virtualenv if you don’t want to clutter up your global packages. Certainly not necessary, but if you want to use a virtualenv just:

$ virtuanelv testenv
$ cd testenv
$ . bin/activate

Then simply install with pip:

$ pip install traffic-light-simulator

Using the source files

Simply clone this repo.

Running the simulator

If you installed with pip, you have a script available to you to run the simulator. Simply enter into your terminal:

$ traffic-light-simulator

Otherwise, if you’ve cloned the repo, just run the traffic_light_simulator/user_interface.py with your interpreter:

$ python user_interface.py

Running the tests

There are some tests that I wrote while writing the TrafficLight class, located in tests.py. If you want to run it simply run it with your interpreter

$ python tests.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

traffic-light-simulator-0.1.1.tar.gz (3.8 kB view details)

Uploaded Source

File details

Details for the file traffic-light-simulator-0.1.1.tar.gz.

File metadata

File hashes

Hashes for traffic-light-simulator-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a9fe76b709c8dda9fa091833f8ee2efd703add8622356b456e644bbe8ffb68ed
MD5 12f69e93236a61c7e3fbea589d743a50
BLAKE2b-256 6d83601e71a953203f9ba7014f8943ab7a397ba298d9b4573d493d4a1f8d92c0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page