graphserach v0.5

This commit is contained in:
Łukasz 2021-04-13 21:34:48 +02:00
parent 84857e357c
commit 7b59525adc
4 changed files with 16 additions and 7 deletions

View File

@ -1,13 +1,21 @@
class Field: class Field:
def __init__(self, __horizontal, __vertical, __state): def __init__(self, horizontal_index, vertical_index, state):
self.horizontal = __horizontal self.__horizontal_index = horizontal_index
self.vertical = __vertical self.__vertical_index = vertical_index
self.__state = __state self.__state = state
@property @property
def state(self): def state(self):
return self.__state return self.__state
@property
def horizontal_index(self):
return self.__horizontal_index
@property
def vertical_index(self):
return self.__vertical_index
@state.setter @state.setter
def state(self, state): def state(self, state):
if state == "toPlow" or state == "toWater" or state == "toSeed" or \ if state == "toPlow" or state == "toWater" or state == "toSeed" or \

View File

@ -33,4 +33,4 @@ FPS = 10
#ANIMATION_PART #ANIMATION_PART
ANIMATION_PART = 11 ANIMATION_PART = 1

View File

@ -33,7 +33,7 @@ def drawInfo(display, tractor, tillageUnit, field, direction):
textsurface = myfont.render(text, False, (0, 0, 0)) textsurface = myfont.render(text, False, (0, 0, 0))
display.blit(textsurface, (50, (DISPLAY_SIZE_VERTICAL - 150))) display.blit(textsurface, (50, (DISPLAY_SIZE_VERTICAL - 150)))
text = f"Current field: {field.horizontal/100, field.vertical/100, field.state} " text = f"Current field: {field.horizontal_index/100, field.vertical_index/100, field.state} "
textsurface = myfont.render(text, False, (0, 0, 0)) textsurface = myfont.render(text, False, (0, 0, 0))
display.blit(textsurface, (50, (DISPLAY_SIZE_VERTICAL - 100))) display.blit(textsurface, (50, (DISPLAY_SIZE_VERTICAL - 100)))

View File

@ -3,6 +3,7 @@ import pygame
import Board import Board
import TractorAction import TractorAction
import drawUI import drawUI
from FindPath import graphsearch
from Tractor import Tractor from Tractor import Tractor
from TractorLoad import TillageUnit from TractorLoad import TillageUnit
from animations import animationsOn, animationsOff from animations import animationsOn, animationsOff
@ -25,7 +26,7 @@ toolCounter = - 1
board = Board.generate() board = Board.generate()
tractor = Tractor(horizontal_index=-0, vertical_index=0, hitch="nothing", header=False, autodrive=True, tractor = Tractor(horizontal_index=-0, vertical_index=0, hitch="nothing", header=False, autodrive=False,
direction='RIGHT') direction='RIGHT')
tillageUnit = TillageUnit("Nothing") tillageUnit = TillageUnit("Nothing")