Hello all,
I working on a rewrite of Wizard of Wor (mostly to teach myself 2600 programming and to get rid of that horrible flicker). I've implemented the maze and I'm thinking of how I am going the logic for maze movement. Here was my basic idea (taken from this thread):
for each monster each frame:
- compute the cell (x, y) that the monster is in. the wizard of wor maze is 11 x 6 cells; each cell is 20x12. (16x8 open, 4x4 walls surrounding it)
- while computing the cell, determine if the monster is at an intersection (x%20 = 0, y%12=0)
- if the monster is at an intersection, choose a random direction to go based on the valid moves. valid moves stored in a lookup table (66 bytes), much like Nukey Shay described (mimic the up/down/left/right bit pattern of SWCHA/B)
Edit: I will only need 33 bytes since the mazes are symmetric and I can use the EOR trick described by Nukey...
for the players, use a similar approach, except you need to allow the user to turn around when not at an intersection.
Does this sound feasible? Is there a quick way to divide by 20 and 12? I know I can divide by 8 first and use a lookup table, but this will only give me the cell. I need to know if there is an intersection. Of course, I could do division by subtraction, but I'm worried this will take too long (but it will give me both cell and yes/no for the intersection).
Any ideas are greatly appreciated.
Thanks,
Edited by johnnywc, Fri Sep 9, 2005 7:13 PM.