Skip to content

nobleans-playground/coding-challenge-racer

Repository files navigation

Coding Challenge: Multiplayer Racing Game Python application

Demo

Tournament results

The main tournament is over. The winner is Matthijs with his bot CaravanRacer. Congratulations! The results can be found in the table below.

The winner of the benchmark tracks was Bram with his bot BrumBot. Rancinerator won the prize of the most efficient bot because he only used 33 lines of code. Rinus won a price for most creative bot because he successfully circumvented the rules by abusing the game's physics engine.

Name Contributor Imposter's circuit Evergreen Ridge Zandvoort Total
CaravanRacer Matthijs 25 15 25 65
Gonzales Lewie 18 18 12 48
Schummi Ferry 15 25 40
Lombardi Gitplant 1 6 18 25
BrumBot Brum 12 12 24
reinzor Rein 6 8 10 24
Racinator Daniel 4 4 15 23
DK Jerrel 10 10 2 22
FurStappen Ferry 8 2 10
AutoSoori Mukunda 1 6 7
ComplicatedBot Mahmoud 4 4
DaBullet MeltedPianoMan 2 1 3
ReverseEngineer Paul 0

Current rankings

Imposter's circuit

Name Contributor Finish time Speed CPU CPU/t
CaravanRacer Matthijs 80.700 274.66 1.4 0.0
Gonzales Lewie 81.667 271.41 1.7 0.1
Schummi Ferry 83.050 266.89 1.1 0.0
Road Runner Rayman [NC] 85.000 260.76 1.2 0.0
BrumBot Brum 88.000 251.87 2.5 0.1
DK Jerrel 89.467 247.75 1.1 0.0
FurStappen Ferry 93.267 237.65 1.2 0.0
reinzor Rein 100.867 219.75 1.0 0.0
ShadowFax Hein [NC] 101.617 218.12 0.9 0.0
Racinator Daniel 103.933 213.26 1.1 0.0
DaBullet MeltedPianoMan 105.317 210.46 3.6 0.1
ComplicatedBot Mahmoud 106.600 207.93 1.0 0.0
Lombardi Gitplant 110.450 200.68 1.2 0.0
AutoSoori Mukunda 125.517 176.59 0.9 0.0
SimpleBot Nobleo 421.367 52.60 0.9 0.0
LilRacer Richard 421.367 52.60 1.0 0.0
Lightyear Sam Altman 421.367 52.60 1.2 0.0
Bottas Nobleo 421.367 52.60 1.0 0.0
ReverseEngineer Paul 422.233 52.49 0.9 0.0
Player 1 Nobleo NaN NaN 1.0 0.0

Evergreen Ridge

Name Contributor Finish time Speed CPU CPU/t
Schummi Ferry 72.083 245.84 1.1 0.0
CaravanRacer Matthijs 74.367 238.29 1.5 0.0
Gonzales Lewie 75.317 235.29 1.7 0.1
Road Runner Rayman [NC] 81.433 217.61 1.2 0.0
reinzor Rein 89.567 197.85 1.0 0.0
Lombardi Gitplant 89.583 197.82 1.2 0.0
DK Jerrel 90.483 195.85 1.1 0.0
Racinator Daniel 93.667 189.19 1.1 0.0
FurStappen Ferry 94.283 187.96 1.2 0.0
AutoSoori Mukunda 98.133 180.58 0.9 0.0
DaBullet MeltedPianoMan 103.150 171.80 3.8 0.1
ComplicatedBot Mahmoud 107.250 165.23 1.0 0.0
ShadowFax Hein [NC] 118.783 149.19 1.0 0.0
BrumBot Brum 119.017 148.90 2.6 0.1
SimpleBot Nobleo 329.967 53.71 1.0 0.0
LilRacer Richard 329.967 53.71 1.0 0.0
Lightyear Sam Altman 329.967 53.71 1.2 0.0
Bottas Nobleo 329.967 53.71 1.0 0.0
ReverseEngineer Paul 330.717 53.58 0.9 0.0
Player 1 Nobleo NaN NaN 1.0 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 @nobleans-playground or @heinwessels to 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 move. 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 [email protected]: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

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages