.
.
This commit is contained in:
parent
64e415d236
commit
9db6e8235a
24
board
24
board
@ -7,6 +7,9 @@ from unicodedata import name
|
||||
import pygame
|
||||
import random
|
||||
import time
|
||||
import subprocess
|
||||
from os import environ
|
||||
environ['PYGAME_HIDE_SUPPORT_PROMPT'] = '1'
|
||||
|
||||
screen = []
|
||||
objectArray = []
|
||||
@ -26,7 +29,7 @@ class Field:
|
||||
self.visited = False
|
||||
self.parent = None
|
||||
number = random.randint(0, 9)
|
||||
if number > 5 and not isObject:
|
||||
if number > 3 and not isObject:
|
||||
self.isBlock = True
|
||||
else:
|
||||
self.isBlock = False
|
||||
@ -105,6 +108,12 @@ def startQueue(agentX, agentY, fieldList, gridNum):
|
||||
|
||||
|
||||
def checkGoal(fieldList, gridNum):
|
||||
if len(fieldQueue) == 0:
|
||||
print("THE PROGRAM FAILED TO FIND THE PATH FOR A GIVEN WALL/AGENT/TARGET TEMPLATE...")
|
||||
print("========= PLEASE DO NOT TURN THE PROGRAM AGAIN ===========")
|
||||
print("========= THE PROGRAM WILL CREATE A NEW TEMPLATE AUTOMATICALLY ==========")
|
||||
subprocess.Popen(['python', 'board'])
|
||||
sys.exit()
|
||||
currentField = fieldQueue.pop(0)
|
||||
|
||||
currentY = currentField.yPos
|
||||
@ -170,13 +179,6 @@ def drawFull(index):
|
||||
pygame.display.update()
|
||||
|
||||
if __name__ == '__main__':
|
||||
pygame.init()
|
||||
|
||||
width = 600
|
||||
height = 530
|
||||
screen = pygame.display.set_mode(
|
||||
(width, height))
|
||||
|
||||
[sX, sY, eX, eY] = generateStartEndPos()
|
||||
|
||||
fields = []
|
||||
@ -197,6 +199,12 @@ if __name__ == '__main__':
|
||||
result = startQueue(objectArray[0].xPos,
|
||||
objectArray[0].yPos, fields, 15)
|
||||
|
||||
pygame.init()
|
||||
|
||||
width = 600
|
||||
height = 530
|
||||
screen = pygame.display.set_mode(
|
||||
(width, height))
|
||||
|
||||
print("RED DOT X AND Y POSITION ============================")
|
||||
print("X: " + str(objectArray[1].xPos) + " Y: " + str(objectArray[1].yPos))
|
||||
|
Loading…
Reference in New Issue
Block a user