Hardware Reference
In-Depth Information
while numberOfVisitedCells < numberOfCells:
possibleDirections = []
if testAllWalls(xposition-1, zposition):
possibleDirections.append("left")
if testAllWalls(xposition+1, zposition):
possibleDirections.append("right")
if testAllWalls(xposition, zposition-1):
possibleDirections.append("up")
if testAllWalls(xposition, zposition+1):
possibleDirections.append("down")
hideMaker(xposition, zposition)
if len(possibleDirections)!=0:
directionChosen=random.choice(possibleDirections)
#knock down wall between cell in direction chosen
if directionChosen=="left":
demolish(realx(xposition)-1, realz(zposition))
xposition -= 1
if directionChosen=="right":
demolish(realx(xposition)+1, realz(zposition))
xposition += 1
if directionChosen=="up":
demolish(realx(xposition), realz(zposition)-1)
zposition -= 1
if directionChosen=="down":
demolish(realx(xposition), realz(zposition)+1)
zposition += 1
numberOfVisitedCells += 1
cellsVisitedList.append((xposition, zposition))
showMaker(xposition, zposition)
continued
Search WWH ::




Custom Search