DZIALAJACA WERSJA
This commit is contained in:
parent
8926837419
commit
8f00d5f087
28
board
28
board
@ -120,22 +120,22 @@ def checkGoal(fieldList, gridNum):
|
||||
currentField.visited = True
|
||||
|
||||
## JEZELI DANE POLE NIE ZOSTALO ODWIEDZONE, TO DODAJEMY DO KOLEJKI WSZYSTKIE POLA OBOK I LECIMY DALEJ
|
||||
if currentIndex + 15 <= 224:
|
||||
if currentIndex + 15 <= 224 and fieldList[currentIndex + 15].visited == False:
|
||||
fieldQueue.append(fieldList[currentIndex + 15])
|
||||
fieldList[currentIndex + 15].parent = fieldList[currentIndex]
|
||||
print("APPENDED DOWN!!!")
|
||||
fieldList[currentIndex + 15].printXandY()
|
||||
if currentIndex - 15 > -1:
|
||||
if currentIndex - 15 > -1 and fieldList[currentIndex - 15].visited == False:
|
||||
fieldQueue.append(fieldList[currentIndex - 15])
|
||||
fieldList[currentIndex - 15].parent = fieldList[currentIndex]
|
||||
print("APPENDED UP!!!")
|
||||
fieldList[currentIndex - 15].printXandY()
|
||||
if (currentIndex + 1) % 15 != 0:
|
||||
if (currentIndex + 1) % 15 != 0 and fieldList[currentIndex + 1].visited == False:
|
||||
fieldQueue.append(fieldList[currentIndex + 1])
|
||||
fieldList[currentIndex + 1].parent = fieldList[currentIndex]
|
||||
print("APPENDED RIGHT!!!")
|
||||
fieldList[currentIndex + 1].printXandY()
|
||||
if (currentIndex - 1) % 15 != 14 or not currentIndex - 1 < 0:
|
||||
if (currentIndex - 1) % 15 != 14 and not currentIndex - 1 < 0 and fieldList[currentIndex - 1].visited == False:
|
||||
fieldQueue.append(fieldList[currentIndex - 1])
|
||||
fieldList[currentIndex - 1].parent = fieldList[currentIndex]
|
||||
print("APPENDED LEFT!!!")
|
||||
@ -145,8 +145,8 @@ if __name__ == '__main__':
|
||||
pygame.init() #inicjalizacja modułów, na razie niepotrzebna
|
||||
|
||||
#Tworzymy nowego playera, czy tam agenta
|
||||
agent = Object("smieciarka", 5, 5)
|
||||
target = Object("cel", 1, 1)
|
||||
agent = Object("smieciarka", 15, 15)
|
||||
target = Object("cel", 1, 2)
|
||||
objectArray.append(agent)
|
||||
objectArray.append(target)
|
||||
|
||||
@ -164,10 +164,22 @@ if __name__ == '__main__':
|
||||
newField.printXandY()
|
||||
fields.append(newField)
|
||||
|
||||
result = startQueue(objectArray[0].xPos, objectArray[0].yPos, fields, 15)
|
||||
result = startQueue(objectArray[0].xPos - 1, objectArray[0].yPos - 1, fields, 15)
|
||||
|
||||
print("RESULT IS: ")
|
||||
|
||||
print("RESULT TARGET IS: ")
|
||||
result.printXandY()
|
||||
print("RESULT TRUCK IS: ")
|
||||
print("X: " + str(objectArray[0].xPos - 1) + " Y: " + str(objectArray[0].yPos - 1))
|
||||
|
||||
|
||||
result_parent = result.parent
|
||||
|
||||
print("CHECKING PARENTS ===========")
|
||||
## FINDING THE MAIN PARENT
|
||||
while input("enter message") != "finish":
|
||||
result_parent.printXandY()
|
||||
result_parent = result_parent.parent
|
||||
|
||||
while 1:
|
||||
c = (255, 255, 255) #tymczasowy kolor tła - do usunięcia, jak już będzie zdjęcie
|
||||
|
Loading…
Reference in New Issue
Block a user