Maze solving: Difference between revisions
Content deleted Content added
Line 1,488:
WAttrib(mz.window,"canvas=normal") # show it
until Event() == &lpress # wait for left mouse press
qMice := set() # Active mice▼
goodMice := set() # Mice that found solutions
startPos := findStart(mz.maze)
# block until all quantum mice have finished
waitForCompletion()
Line 1,558 ⟶ 1,557:
every r := 1 to *region do region[r] := list(*m[1])
every !!region := mutex()
▲ qMice := set() # Active mice
}
insert(qMice,self)
maze := m
loc := l
Line 1,568 ⟶ 1,569:
if atEnd() then insert(goodMice, self) # This mouse found a finish
else { # Spawn more mice to look for finish
}
delete(qMice, self)
|