moin, sitze hier und komm nicht vom fleck.
mein problem: will ein zufälliges labyrinth erstellen, bei dem es immer einen weg gibt.
ansatz (pseudocode):
depth-first-code
LiFoStack stack= null
int totalCells = labyrinth.höhe * labyrinth.breite
cell currentCell = labyrinth.random (x,y)
int visitedCells = 1
while (visitedCells < totalCells)
neighborCell = labyrinth.randomNeighborCellWithWallsUp(currentCell)
if neighborCell == 0
currentCell = stack.pop()
else
labyrinth.removeWall(currentCell, neighborCell)
stack.push(currentCell)
currentCell = neighborCell
visitedCells++
end if
end while
wie schreibe ich diesen code in java (swing, awt, beans)??
und wie sieht der code dann aus?
hoffe mir kann jemand helfen.
danke
mein problem: will ein zufälliges labyrinth erstellen, bei dem es immer einen weg gibt.
ansatz (pseudocode):
depth-first-code
LiFoStack stack= null
int totalCells = labyrinth.höhe * labyrinth.breite
cell currentCell = labyrinth.random (x,y)
int visitedCells = 1
while (visitedCells < totalCells)
neighborCell = labyrinth.randomNeighborCellWithWallsUp(currentCell)
if neighborCell == 0
currentCell = stack.pop()
else
labyrinth.removeWall(currentCell, neighborCell)
stack.push(currentCell)
currentCell = neighborCell
visitedCells++
end if
end while
wie schreibe ich diesen code in java (swing, awt, beans)??
und wie sieht der code dann aus?
hoffe mir kann jemand helfen.
danke