1-
21from back_elements .wall import Wall
32from back_elements .surface import Surface
43from enums_and_parser .surfaceType import SurfaceType
@@ -22,14 +21,14 @@ def draw_map(self, map):
2221 for row in csv_reader :
2322 rows .append (row )
2423
25- #planned CSV structure ->
26- #0 type(string -> what is it, wall / surface),
27- #1 position x,
28- #2 position y,
29- #3 width,
30- #4 height,
31- #5 surfaceType or with_tires to specify
32- #6 rotation -> if it has image, how much is it rotated
24+ # planned CSV structure ->
25+ # 0 type(string -> what is it, wall / surface),
26+ # 1 position x,
27+ # 2 position y,
28+ # 3 width,
29+ # 4 height,
30+ # 5 surfaceType or with_tires to specify
31+ # 6 rotation -> if it has image, how much is it rotated
3332 for row in rows :
3433 position = Vector2D (int (row [1 ]), int (row [2 ]))
3534 width = int (row [3 ])
@@ -45,7 +44,8 @@ def draw_map(self, map):
4544 elif row [0 ] == "SURFACE" :
4645 if row [5 ] == "ASPHALT" :
4746 map .all_surfaces .add (Surface (position , width , height , SurfaceType .ASPHALT , rotation ))
48- map .places_for_boosters .append ([position .x + 40 , position .y + 40 , position .x + width - 40 , position .y + height - 40 ])
47+ map .places_for_boosters .append (
48+ [position .x + 40 , position .y + 40 , position .x + width - 40 , position .y + height - 40 ])
4949
5050 elif row [5 ] == "SNOW" :
5151 map .all_surfaces .add (Surface (position , width , height , SurfaceType .SNOW , rotation ))
@@ -74,12 +74,12 @@ def draw_map(self, map):
7474
7575 file .close ()
7676
77- def write_to_leaderboard (self ,result , name , map , car ):
78- #assuming the following schema of the CSV file:
79- #0 - player name
80- #1 - player result(time)
81- #2 - map
82- #3 - car model
77+ def write_to_leaderboard (self , result , name , map , car ):
78+ # assuming the following schema of the CSV file:
79+ # 0 - player name
80+ # 1 - player result(time)
81+ # 2 - map
82+ # 3 - car model
8383
8484 file = open (self .leaderboard )
8585 csv_writer = csv .writer (file )
@@ -96,18 +96,16 @@ def read_leaderboard(self):
9696 rows = []
9797
9898 for row in csv_reader :
99- row .append (row )
100-
101- #now we can do what we want with the rows - it's up to us what
99+ rows .append (row )
102100
103101 file .close ()
104102 pass
105103
106- def read_car_statistics (self , car_id :int ):
107- #planned cars file structure:
108- #[0] - id
109- #[1] - NAME
110- #[2] - engine
104+ def read_car_statistics (self , car_id : int ):
105+ # planned cars file structure:
106+ # [0] - id
107+ # [1] - NAME
108+ # [2] - engine
111109
112110 file = open (self .cars )
113111 csv_reader = csv .reader (file )
@@ -118,5 +116,4 @@ def read_car_statistics(self, car_id:int):
118116 for row in csv_reader :
119117 rows .append (row )
120118
121- #we return this data to engine or whatever and it will create a car
122119 return int (rows [car_id ][0 ]), rows [car_id ][1 ], int (rows [car_id ][2 ])
0 commit comments