forked from s452751/AI_PRO
v. 1.06
This commit is contained in:
parent
b705cb2b1c
commit
d778014e92
16
Field.py
16
Field.py
@ -1,5 +1,13 @@
|
|||||||
class Field:
|
class Field:
|
||||||
def __init__(self, horizontal, vertical, state):
|
def __init__(self, __horizontal, __vertical, __state):
|
||||||
self.horizontal = horizontal
|
self.horizontal = __horizontal
|
||||||
self.vertical = vertical
|
self.vertical = __vertical
|
||||||
self.state = state
|
self.__state = __state
|
||||||
|
|
||||||
|
@property
|
||||||
|
def state(self):
|
||||||
|
return self.__state
|
||||||
|
|
||||||
|
@state.setter
|
||||||
|
def state(self, state):
|
||||||
|
self.__state = state
|
||||||
|
40
Tractor.py
40
Tractor.py
@ -5,3 +5,43 @@ class Tractor:
|
|||||||
self.hitch = hitch
|
self.hitch = hitch
|
||||||
self.header = header
|
self.header = header
|
||||||
self.fuel_tank = fuel_tank
|
self.fuel_tank = fuel_tank
|
||||||
|
|
||||||
|
@property
|
||||||
|
def horizontal_index(self):
|
||||||
|
return self.__horizontal_index
|
||||||
|
|
||||||
|
@horizontal_index.setter
|
||||||
|
def horizontal_index(self, horizontal_index):
|
||||||
|
self.__horizontal_index = horizontal_index
|
||||||
|
|
||||||
|
@property
|
||||||
|
def vertical_index(self):
|
||||||
|
return self.__vertical_index
|
||||||
|
|
||||||
|
@vertical_index.setter
|
||||||
|
def vertical_index(self, vertical_index):
|
||||||
|
self.__vertical_index = vertical_index
|
||||||
|
|
||||||
|
@property
|
||||||
|
def hitch(self):
|
||||||
|
return self.__hitch
|
||||||
|
|
||||||
|
@hitch.setter
|
||||||
|
def hitch(self, hitch):
|
||||||
|
self.__hitch = hitch
|
||||||
|
|
||||||
|
@property
|
||||||
|
def fuel_tank(self):
|
||||||
|
return self.__fuel_tank
|
||||||
|
|
||||||
|
@fuel_tank.setter
|
||||||
|
def fuel_tank(self, fuel_tank):
|
||||||
|
self.__fuel_tank = fuel_tank
|
||||||
|
|
||||||
|
@property
|
||||||
|
def header(self):
|
||||||
|
return self.__header
|
||||||
|
|
||||||
|
@header.setter
|
||||||
|
def header(self, header):
|
||||||
|
self.__header = header
|
@ -5,7 +5,7 @@ DISPLAY_SIZE_HORIZONTAL = 600
|
|||||||
DISPLAY_SIZE_VERTICAL = 600
|
DISPLAY_SIZE_VERTICAL = 600
|
||||||
|
|
||||||
#TILE DIVIDER = TILE SIZE
|
#TILE DIVIDER = TILE SIZE
|
||||||
TILE_SIZE = 50
|
TILE_SIZE = 30
|
||||||
|
|
||||||
# number of tiles
|
# number of tiles
|
||||||
HORIZONTAL_TILES_NUMBER = DISPLAY_SIZE_HORIZONTAL/TILE_SIZE
|
HORIZONTAL_TILES_NUMBER = DISPLAY_SIZE_HORIZONTAL/TILE_SIZE
|
||||||
@ -22,8 +22,6 @@ GREEN = (0, 255, 0) #DO SCIECIA
|
|||||||
|
|
||||||
|
|
||||||
#tractor const
|
#tractor const
|
||||||
TRACTOR_HORIZONTAL_LOCATION = DISPLAY_SIZE_HORIZONTAL/2
|
|
||||||
TRACTOR_VERTICAL_LOCATION = DISPLAY_SIZE_VERTICAL/2
|
|
||||||
|
|
||||||
TRACTOR_WIDTH = TILE_SIZE
|
TRACTOR_WIDTH = TILE_SIZE
|
||||||
TRACTOR_HEIGHT = TILE_SIZE
|
TRACTOR_HEIGHT = TILE_SIZE
|
||||||
|
10
drawUI.py
10
drawUI.py
@ -15,15 +15,15 @@ def makeField(board, display):
|
|||||||
for j in range(int(VERTICAL_TILES_NUMBER)):
|
for j in range(int(VERTICAL_TILES_NUMBER)):
|
||||||
field = board[i][j]
|
field = board[i][j]
|
||||||
|
|
||||||
if field.state == 0:
|
if field.get_state() == 0:
|
||||||
color = WHITE
|
color = WHITE
|
||||||
elif field.state == 1:
|
elif field.get_state() == 1:
|
||||||
color = RED
|
color = RED
|
||||||
elif field.state == 2:
|
elif field.get_state() == 2:
|
||||||
color = YELLOW
|
color = YELLOW
|
||||||
elif field.state == 3:
|
elif field.get_state() == 3:
|
||||||
color = GREEN
|
color = GREEN
|
||||||
elif field.state == 4:
|
elif field.get_state() == 4:
|
||||||
color = BLACK
|
color = BLACK
|
||||||
pygame.draw.rect(display, color,
|
pygame.draw.rect(display, color,
|
||||||
[i * TILE_SIZE, j * TILE_SIZE, TILE_SIZE, TILE_SIZE])
|
[i * TILE_SIZE, j * TILE_SIZE, TILE_SIZE, TILE_SIZE])
|
||||||
|
2
main.py
2
main.py
@ -18,7 +18,7 @@ vertical_change = 0
|
|||||||
|
|
||||||
board = Board.generate()
|
board = Board.generate()
|
||||||
|
|
||||||
tractor = Tractor(horizontal_index=0, vertical_index=0, hitch="nothing", header="none", fuel_tank=100)
|
tractor = Tractor(horizontal_index=0, vertical_index=0, hitch="nothing", header=False, fuel_tank=100)
|
||||||
|
|
||||||
clock = pygame.time.Clock()
|
clock = pygame.time.Clock()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user