Skip to content

nobleans-playground/coding-challenge-racer

Repository files navigation

Coding Challenge: Multiplayer Racing Game Python application

Demo

Current rankings

Imposter's circuit

Name Contributor Finish time Speed CPU CPU/t
CaravanRacer Matthijs 82.733 267.91 0.2 0.0
Road Sprinter Rayman [NC] 83.717 264.76 0.2 0.0
Gonzales Lewie 84.517 262.26 0.3 0.0
Road Runner Rayman [NC] 87.167 254.28 0.2 0.0
VietRacer Hoang 88.717 249.84 0.4 0.0
BrumBot Brum 91.050 243.44 0.4 0.0
DK Jerrel 92.217 240.36 0.2 0.0
Schummi Ferry 92.333 240.05 0.2 0.0
FurStappen Ferry 95.200 232.83 0.2 0.0
reinzor Rein 103.317 214.53 0.2 0.0
ShadowFax Hein [NC] 103.867 213.40 0.2 0.0
Racinator Daniel 106.350 208.42 0.2 0.0
DaBullet MeltedPianoMan 107.350 206.47 0.7 0.0
Lombardi Gitplant 107.817 205.58 0.2 0.0
ComplicatedBot Mahmoud 109.433 202.54 0.2 0.0
AutoSoori Mukunda 128.633 172.31 0.2 0.0
SimpleBot Nobleo 432.600 51.24 0.7 0.0
ReverseEngineer Paul 433.450 51.14 0.7 0.0
Player 1 Nobleo NaN NaN 0.9 0.0

Evergreen Ridge

Name Contributor Finish time Speed CPU CPU/t
Schummi Ferry 73.900 239.80 0.2 0.0
Gonzales Lewie 75.700 234.10 0.3 0.0
CaravanRacer Matthijs 76.267 232.36 0.2 0.0
Road Sprinter Rayman [NC] 77.883 227.53 0.2 0.0
Road Runner Rayman [NC] 83.033 213.42 0.2 0.0
BrumBot Brum 88.017 201.34 0.4 0.0
DK Jerrel 89.250 198.56 0.2 0.0
reinzor Rein 91.533 193.60 0.2 0.0
Lombardi Gitplant 92.900 190.75 0.2 0.0
VietRacer Hoang 95.033 186.47 0.5 0.0
Racinator Daniel 95.817 184.95 0.2 0.0
FurStappen Ferry 96.217 184.18 0.2 0.0
AutoSoori Mukunda 101.033 175.40 0.2 0.0
DaBullet MeltedPianoMan 105.133 168.56 0.8 0.0
ComplicatedBot Mahmoud 109.033 162.53 0.2 0.0
ShadowFax Hein [NC] 120.733 146.78 0.2 0.0
SimpleBot Nobleo 340.367 52.06 0.6 0.0
ReverseEngineer Paul 341.100 51.95 0.6 0.0
Player 1 Nobleo NaN NaN 0.9 0.0

Zandvoort

Name Contributor Finish time Speed CPU CPU/t
CaravanRacer Matthijs 77.183 230.49 0.2 0.0
Schummi Ferry 77.850 228.51 0.2 0.0
Road Sprinter Rayman [NC] 82.233 216.33 0.2 0.0
Road Runner Rayman [NC] 86.600 205.43 0.2 0.0
Lombardi Gitplant 105.500 168.62 0.2 0.0
VietRacer Hoang 111.617 159.38 0.5 0.0
Racinator Daniel 111.633 159.36 0.2 0.0
Gonzales Lewie 114.583 155.26 0.4 0.0
reinzor Rein 119.983 148.27 0.2 0.0
AutoSoori Mukunda 124.767 142.58 0.2 0.0
ComplicatedBot Mahmoud 133.767 132.99 0.3 0.0
DK Jerrel 144.617 123.01 0.3 0.0
DaBullet MeltedPianoMan 184.533 96.40 1.6 0.1
ShadowFax Hein [NC] 184.567 96.39 0.3 0.0
SimpleBot Nobleo 348.667 51.02 0.6 0.0
ReverseEngineer Paul 349.250 50.94 0.7 0.0
Player 1 Nobleo NaN NaN 1.0 0.0
BrumBot Brum NaN NaN 2.0 0.1
FurStappen Ferry NaN NaN 1.1 0.0

Description

The goal is to build a bot that is faster than all other bots.

You should write your bots logic in a Python class. Each frame, the update method of your bot will be called with the current state of the game and the bot should return the desired action to take.

There is one example bot implemented: SimpleBot. You can use that repository as starting point for your bot. Read How to submit a bot to learn how to get started.

How to run the game

On the command line, go to the folder where you have cloned this repository and run the following command:

python3 main.py

For more information see the section How to start developing a bot.

Game rules

  1. The exact rules of the game are implemented in racer/game_state.py.
  2. You must go through each waypoint in the track in the correct order. The track is a closed loop, so after the last waypoint you have to drive again over the first one.
  3. The bot that completes 3 rounds on the track first wins.

Tournament rules

  1. You are allowed to submit a maximum of two bots.
  2. Your bot must be your own creation. This rule is so that you may not blatantly copy someone's bot, change only a few lines, and then submit it as your own. Some code duplication is of course inevitable and thus allowed, because the logic might be similar between bots. You are allowed to use AI tools to help you create your bot.
  3. The code of the game is law. The rules of the game are implemented in the code. If you want to know the specific rules of the game, please look at the code. If the game determines you've won a game, that is the outcome.
  4. Please limit the processing time of your bot. Currently, there's a hard limit of 16ms average time-per-frame as measured by tournament.py. Please talk to one of the organizers if you think this is too short. You can also use a profiler to try and make your code faster.
  5. You can only use the Python libraries that are in the requirements.txt file. If you want to use another library, please let one of the organizers know.
  6. Multithreading is not allowed
  7. You are not allowed to read or alter the game's internal state, or the state of other bots. You can only use the information that is given via the interface. You are allowed to import the game's classes and use them in your bot.

How to submit a bot

Your bot will live as a git submodule inside the main challenge repository. This means you will need to create your own GitHub account and create a new repository based on a template. You can follow the following steps to create your own bot.

Note: You are allowed to submit a maximum of two bots.

  1. Create a GitHub account if you don't have one already. Using a personal account is fine.
  2. Create a personal repository where your bot will live. You can do this by clicking the "Use this template" button in this repo, or by forking the repository.
  3. Give your bot a name and add your own name as contributor
  4. Notify an organizer (@Rayman) by creating a GitHub issue or send me an email. Then I'll add your bot to the challenge as a submodule in the main repository.

Note: Your bot doesn't have to be complete to be added, it simply needs to run and return a valid input. You can update/change/refactor your bot at any point during the challenge.

How to start developing a bot

  1. Clone this repository using git clone --recursive git@github.com:nobleans-playground/coding-challenge-racer.git. The --recursive is to pull in all submodule bots.
  2. Install all the dependencies
    • On linux sudo apt install -y python3-numpy python3-pygame python3-scipy python3-tqdm && pip3 install --user pygame_widgets --break-system-packages
    • On Windows pip install -r requirements.txt
  3. Run main.py or any of the other executables

How to add your bot to the game

  • If you bot has NOT being added to the main repository, clone the repository that you created from the template to the racer/bots folder. Don't forget to add it to the bots list in racer/bots/__init__.py. See racer/bots/example/bot.py for inspiration.
  • If you bot has been added to the main repository, just edit the files in your own bots folder.

Updating your local repository with the newest changes

Over the course of the challenge your local repository might be out-of-date with all the other bots. To update the environment you can run the following two commands from the root folder.****

# Pull the latest game-code
git pull
# Pull the latest code from all the bots
git submodule update --init

Description of all the executables

  • main.py: Battle all bots against each other in a graphical user interface.
  • tournament.py: Battle all bots against each other on the command line.

About

The goal is to build a bot that is faster than all other bots.

Resources

License

Stars

Watchers

Forks