Skip to content

rollandf/ROSE

 
 

Repository files navigation

ROSE Project

Build Status

This project is a game that has been developed to assist in teaching kids python. The students need to code the behavior of a car to achieve the best score.

Here is a video of a race (running code from students): (Click on the screenshot to play the video)

ROSE Race Car Game

In this game, two race cars compete to achieve the most points. The race car must recognize the race track, the obstacles, and the bonus areas; then calculate the best path where the pitfalls are avoided and all the bonus points are collected. The cars move autonomously on the screen within the race track game with no interference from the students. No joystick or mouse shall be used.

In order to control the car movements, the students needs to implement a 'driver'. This code controls the car and will decide what the next action of the car will be.

For each type of obstacles there is a different action and different points assigned.

See examples/README.md for an explanation on how to write a driver module.

GitHub pages

Refer to our GitHub pages for the course materials and additional resources: https://redhat-israel.github.io/ROSE/

Talks and presentations

Requirements

Once we're in the ROSE directory, we need to verify we have pipenv installed. In order to make sure we have pipenv installed:

pipenv --version

If you don't have it installed, the best way is to install it only for your user:

pip install --user pipenv

Getting started

The following commands should be performed only once; after creating the environment you will be connecting to the same environment each time you open a new session.

Use pipenv to create a virtual environment and to install the rest of the dependencies:

pipenv --python /usr/local/bin/python3.7 install

You can also install packages from your distribution, but they may be too old.

After creating the environment, we want to activate and enter our environment:

pipenv shell

Indication that you are inside the environment, the prompt line will look like this:

(ROSE) [username@hostname ROSE]$

Running the server

If you are not in your virtual environment, please run it:

pipenv shell

Start the server on some machine:

./rose-server

For running the same track for all drivers (instead or random) start the server using:

./rose-server -t same

Open a browser at http://<server-address>:8880 to view and control the game.

Running a driver

In a new window, open your virtual environment:

pipenv shell

Start up the client, using your driver file:

./rose-client mydriver.py

The server address can be specified that way (Replace '10.20.30.44' with your server address):

./rose-client -s 10.20.30.44 mydriver.py

For driver modules, see the examples directory.

You can run the game with just 1 driver! To let 2 drivers compete, repeat these commands in 2 terminals.

Command line interface

You can control the game from the command line using the rose-admin tool.

To start a race, use the rose-admin tool on any machine:

./rose-admin <server-address> start

To stop a race, use the rose-admin tool on any machine:

./rose-admin <server-address> stop

To modify the game rate, you can use the "set-rate" command. The following command would change game rate to 10 frames per second:

./rose-admin <server-address> set-rate 10

Creating a tarball

python setup.py sdist

Developing

Should you want to contribute to the project, please read the Code of Conduct.

To install development requirements:

pipenv install --dev

To open a shell for development, use:

pipenv --python /usr/local/bin/python3.7 shell

Before submitting patches, please run the tests:

flake8
pytest

Creating coverage report in html format:

pytest --cov-report html
xdg-open htmlcov/index.html

About

Car race game for ROSE

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 72.3%
  • JavaScript 21.9%
  • CSS 3.1%
  • HTML 2.3%
  • Makefile 0.4%