Racetrack
Race created. Game code:
Send the link to the other players. Each of them picks their name there.
My recent games
How it works
Each car has a speed in the x and y direction. On each move, each component may change by at most 1 – nine possible target cells. Anyone who hits a wall stops right in front of it, loses their momentum, and gets a 4-second penalty. In sand, the maximum speed is 2. Whoever is first to cross the finish line the set number of times wins.
| Track | Sand (max. speed 2) | ||
| Wall | Finish line |
Finish: If several moves cross the finish line, tenths of a second are counted – the fastest is the move with the highest speed that crosses the line most directly.
Formula: tenths = distance to the line ÷ total length of the move (each move takes 1 second). The line sits exactly between the finish-line cell and the following cell – half a cell width.
How does the bot drive?
A path-cost map is calculated once for the track – starting from the finish line, it spreads backwards over all drivable cells, where each track cell costs 1 and each sand cell costs 3. This reliably finds the shortest path even on winding tracks.
On each move, the bot checks all 9 possible accelerations and scores each one: a move always costs 25 points, and the remaining distance to the end of the race (remaining laps plus the path to the finish line from the map) is factored in at a weight of 10 – so a longer remaining path makes the option worse. Depending on the bot's driving style, further deductions apply: 210 to 340 points for a crash, 9 to 23 points if the move ends in sand, and 0 to 2 points if a move's target cell is right next to a wall (diagonals included). Because the deductions are added up over the look-ahead, driving along a wall costs several times. Finally, the resulting speed is also counted, multiplied by a speed factor of 1.0 to 2.4 – so driving faster raises the score slightly, though much less than the other factors.
The bot also looks ahead up to four moves: the costs of up to four consecutive moves are added together, but only the first of these moves is actually driven – the rest only serve to assess the quality of that first decision more realistically.
Of the 9 options, the bot picks the one with the best overall score. Each option also gets a small random offset of up to 7 points, and every bot gets a slightly different driving style – so no race feels exactly the same.
Rotating turn order
Normally, start position 1 moves first in every round, then 2, 3 … Whoever moves first can claim a square ahead of the others. With a rotating turn order, position 1 starts the first round; after that the starting position shifts by one place each round (1,2,3 – 2,3,1 – 3,1,2 …), so everyone gets to move first equally often. With two drivers, the same driver therefore moves twice in a row at every round change.