Académique Documents
Professionnel Documents
Culture Documents
;
;
;
;
;
;
;
;
;
;
This is the SKELETON of an 8051 program that should solve any maze.
In its present form it employs the algorithm:
1) If you are on the cheese, then stay there.
2) Otherwise, if you can move forward, then move forward.
3) Otherwise, if you can move left, then move left.
4) Otherwise, if you can move right, then move right.
5) Otherwise, if you can move backwards, then move backwards.
6) Otherwise, complain about being placed in a defective maze.
By running the program you will be able to observe that this
is not the best algorithm. Your job is to find and implement
a better algorithm.
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
EQU
EQU
EQU
EQU
0x00
0x01
0x02
0x03
LeftWall
FrontWall
RightWall
RearWall
Cheese
EQU
EQU
EQU
EQU
EQU
0
1
2
3
7
Loop:
JNB P1.Cheese, Move ; check for the presence of cheese
Eat:
SJMP Eat
Move:
JNB P1.FrontWall, NoFrontWall