.
This commit is contained in:
ddamiankowalski 2022-04-08 01:45:42 +02:00
parent aee0fcf2f5
commit 64e415d236

12
board
View File

@ -26,7 +26,7 @@ class Field:
self.visited = False self.visited = False
self.parent = None self.parent = None
number = random.randint(0, 9) number = random.randint(0, 9)
if number > 7 and not isObject: if number > 5 and not isObject:
self.isBlock = True self.isBlock = True
else: else:
self.isBlock = False self.isBlock = False
@ -166,7 +166,7 @@ def drawFull(index):
black = (0, 0, 0) black = (0, 0, 0)
pygame.draw.rect(screen, black, pygame.Rect((node.xPos + 1) * 500 / 15 + 30, (node.yPos + 1) * 500 / 15 - 10, 10, 10)) pygame.draw.rect(screen, black, pygame.Rect((node.xPos + 1) * 500 / 15 + 30, (node.yPos + 1) * 500 / 15 - 10, 10, 10))
kb_listen(objectArray, 15) ##kb_listen(objectArray, 15)
pygame.display.update() pygame.display.update()
if __name__ == '__main__': if __name__ == '__main__':
@ -218,7 +218,7 @@ if __name__ == '__main__':
for node in pathToTarget: for node in pathToTarget:
node.printXandY() node.printXandY()
print("PRINTING ACTIONS TO TAKE TO GET TO THE TARGET ============================") print("============================ SEARCH PROBLEM DIAGRAM ============================")
for node in pathToTarget: for node in pathToTarget:
currentNode = node currentNode = node
parentNode = node.parent parentNode = node.parent
@ -244,8 +244,10 @@ if __name__ == '__main__':
direction = "NORTH" direction = "NORTH"
objectArray[0].yPos = objectArray[0].yPos - 1 objectArray[0].yPos = objectArray[0].yPos - 1
time.sleep(1) time.sleep(1)
print("ACTION: TURN TO " + direction) print("---- NEXT STEP ---- ")
### OPIDSZ TUTAJ print("AGENT TURNING TO " + direction)
print("AGENT MOVING FORWARD")
print("ACTUAL AGENT STATE: (X -> " + str(objectArray[0].xPos) + ", Y -> " + str(objectArray[0].yPos) + ", " + direction + ")")
draw(15, objectArray, pathToTarget, 1) draw(15, objectArray, pathToTarget, 1)
pygame.display.update() pygame.display.update()