|
![](/i/fill.gif) |
andrel wrote:
>> This is the unit test for my rectangular maze code:
>> http://www.youtube.com/watch?v=X2mkwcfEd_8
>>
>
> Haven't got a clue what is going on.
That's why it's not a public link yet.
1) Create all the rooms with possibly-destructable (grey) walls.
2) Caller marks some rooms as "pre-open" (green), blocked (red) or post-open
(blue). So, the top left green might be a tennis court, the bottom left
green might be a drive and parking lot, the red in the middle might be a
building, the other red might be a swimming pool with a path around it, and
the blue might be where a part of the maze burned down after it was built.
So "green" acts as one big room, while "blue" has the possibility of adding
loops to the maze.
3) Mark blocked walls and walls open inside a blocked area.
4) Repeatedly pick a grey wall and examine the rooms on either side. If the
rooms are connected, make the wall black. If they're not, make the wall
white, then flood fill the smaller area to mark it as connected to the
larger area (the yellow). Stop when you've examined all walls.
5) Blow up any walls son the border of a blue room, even if that means
creating a new connection between rooms already connected.
Then, some demos of the path-finding:
A) Pick a goal room in Cyan.
B) Flood-fill from that room with the distance to the goal.
C) Put a logo in another room.
D) Repeatedly move the logo to the adjacent room with the lower
distance until you get to the goal.
--
Darren New, San Diego CA, USA (PST)
Serving Suggestion:
"Don't serve this any more. It's awful."
Post a reply to this message
|
![](/i/fill.gif) |