Zelaron Gaming Forum  
Stats Arcade Portal Forum FAQ Community Calendar Today's Posts Search
Go Back   Zelaron Gaming Forum > The Zelaron Nexus > Science and Art > Tech Help

 
 
Thread Tools Display Modes

 
Reply
Posted 2004-09-18, 01:12 PM in reply to Demosthenes's post "Need a little help"
If you give the mouse a "facing" direction (say, north = 0, west = 1, etc) then you can do something like the following:

Code:
"Feel" the wall to the left of the mouse, depending on his direction
IF (WallIsThere == false)
{
   Rotate Counter-Clockwise
   Move Forward
}
ELSE
{
    Check in front of the mouse
    IF (WallInFront == false)
    {
         Move Forward
    }
    ELSE
    {
         Rotate Couter-Clockwise
    }

}
Anytime you call the "Move Forward" function, you toggle the current floor marker (. or +), then move your ghosted mouse to the next tile. This will "clear" the marker if you hit a dead end. The mouse will try all possible places (luckily there are no loops..).

Of course, you'll probably end up with diagonals where the mouse tested a dead-end. In your example, here's the output:

Code:
# # # # # # # # # #
# . # M + . # . . # 
# . # # + # # # . #
# . . . + + . . . #
# # # # . # + # # #
# . . . . # + # C #
# # # # # # + # + #
# . # . . . + # + #
# . . . # . + + + #
# # # # # # # # # #
This is easy to fix. Just scan the entire maze for "." tiles, and check the tiles surrounding it in the four compass directions. If you get 2 "+"'s, add a "+" to that period tile.

I'm going to run this in my head a few times to see if I can spot any errors in my logic..

Last edited by BlueCube; 2004-09-18 at 01:15 PM.
Old
Profile PM WWW Search
BlueCube enjoys the static noises of ten television sets simultaneously tuned to 412.84 MHzBlueCube enjoys the static noises of ten television sets simultaneously tuned to 412.84 MHz
 
 
BlueCube
 



 
Reply
Posted 2004-09-18, 05:45 PM in reply to BlueCube's post starting "If you give the mouse a "facing"..."
Thanks BlueCube. That seems to make sense. I'll give it a shot. If that doesn't work, I was thinking about using a depth-first search. Do you think that would work?
Old
Profile PM WWW Search
Demosthenes seldom sees opportunities until they cease to beDemosthenes seldom sees opportunities until they cease to beDemosthenes seldom sees opportunities until they cease to beDemosthenes seldom sees opportunities until they cease to be
 
Demosthenes
 



 

Bookmarks

« Previous Thread | Next Thread »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules [Forum Rules]
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -6. The time now is 06:14 AM.
'Synthesis 2' vBulletin 3.x styles and 'x79' derivative
by WetWired the Unbound and Chruser
Copyright ©2002-2008 zelaron.com
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
This site is best seen with your eyes open.