Skip to content

Commit

Permalink
Add benchmark tracks
Browse files Browse the repository at this point in the history
  • Loading branch information
Rayman committed Dec 3, 2024
1 parent 6c35653 commit b6dc990
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 0 deletions.
6 changes: 6 additions & 0 deletions racer/tracks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
from . import track1
from . import track2
from . import track4
from . import track5
from . import track6

all_tracks = [
track1,
track2,
track4,
track5,
track6,
]
Binary file added racer/tracks/stars.webp
Binary file not shown.
15 changes: 15 additions & 0 deletions racer/tracks/track4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Path: coding-challenge-racer/extract_svg_path
import os.path

import pygame

name = 'Square'
background = pygame.image.load(os.path.dirname(__file__) + '/stars.webp')
scale = 1
track_width = 30
lines = [
(200, 880),
(880, 880),
(880, 200),
(200, 200),
]
18 changes: 18 additions & 0 deletions racer/tracks/track5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Path: coding-challenge-racer/extract_svg_path
import os.path

import pygame

name = 'Rectangle'
background = pygame.image.load(os.path.dirname(__file__) + '/stars.webp')
scale = 1
track_width = 30

(w, h) = background.get_size()

lines = [
(200, 880),
(w - 200, 880),
(w - 200, 680),
(200, 680),
]
17 changes: 17 additions & 0 deletions racer/tracks/track6.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Path: coding-challenge-racer/extract_svg_path
import os.path
from math import sin, cos

import numpy as np
import pygame

name = 'Circle'
background = pygame.image.load(os.path.dirname(__file__) + '/stars.webp')
scale = 1
track_width = 30

r = (1080 - 200) / 2
cx = r + 300
cy = 1080 - r - 100

lines = [(cx + r * cos(t), cy + r * sin(t)) for t in np.linspace(0, 2 * np.pi, 40)[:-1]]

0 comments on commit b6dc990

Please sign in to comment.