Note: The project description was updated significantly on Wed, Oct 16th.
I turned to my guide, who was frozen with terror.
``Pasquale. Calm down. It's just a statue.''
``No sir, it's not. You don't know what you're getting yourself into. The ancient gods have been awakened.''
``Look, Pasquale, I've been awakening ancient gods all my life. It's my job. They call my service before they go to sleep and tell us when to wake them up.''
Pasquale looked at me strangely.
``Senior. This is no laughing matter. You are about to trespass into the otherworld.''
``What other world?''
``No, the otherworld. It's a place. It's guarded by demons and beasts. Terrible things happen to mortals who dare enter, and you risk wakening the ancients and threating the whole human race.''
``OK. Just point me in the right direction.''
Pasquale turned and ran. Having had some exeperience with this type of thing, I figured he was running away from the otherworld as opposed to towards it, so I proceeded in the opposite direction from Pasquale.
It didn't take long for the jungle to become nearly impassable. Pasquale had taken the machete with him, and so I was left to hacking at the undergrowth with my pocketknife, which had already become quite dull. I finally broke through a particularly thick section, and came upon a cave entrance. Over the entrance was a sign printed in heiroglyphics.
I took out my Newton and unsealed the weatherproofing. I had a nearly complete reference for this written language, and only one of the characters was unknown to me. Without it, the sign read, ``Now Entering new-symbol. Discard your soul. No smoking.'' Based on Pasquale's fears, I inferred the new symbol to be the one for ``otherworld.'' I noted it, tossed aside my cigar, and entered.
It was some time before I reached the main chamber of the cave, keeping a careful map on the screen of my Newton. I had averted numerous traps of the standard variety already, and ducked low as another pendulum swung for my head. The rotting beam that the device was suspended from broke, however, sending it crashing into the altar. This activated a series of traps at once, and as I dove and rolled to avoid the flying projectiles, I slid over a trap door and fell.
I fell for a while, and felt sure the landing would kill me, but suddenly there was an intensely strong updraft that nearly stopped my descent, and I landed on something hard. I picked myself up, and the lights came on.
I was standing in a huge chamber. One one end was a gallery teeming with numerous beasts and demons, and on the other were five huge stone thrones. Sitting in each throne was a humanoid figure that would have stood fifty feet tall. At first glance the throned figures seemed to be statues, but their eyes betrayed life.
``Welcome,'' the central figure spoke. His voice boomed and echoed through the chamber.
I pointed to myself questioningly.
``Yes, you. You have awakened us. We are the ancient gods.''
I cleared my throat. ``YOU are the ancients? '' I pointed to the demonic rabble on the other end. ``Wow, I thought they were. You guys look great. I wouldn't have guessed a day over thirty.''
``Oh, thank you. Of course, several thousand years of sleep does wonders for the complexion.''
``Ahhhh. Of course. I don't suppose a few thousand more would help?''
``I am K'thalm'g'ra'tu,'' he continued.
I hastily began jotting on my Newton, and held up my hand. ``Just hold on a second, I have to use letter by letter recognition...'' The gods looked puzzled for a moment. ``OK,'' I said. ``Do you have a Phone number?''
``We are bound by the laws of our imprisonment to offer you a challenge. If you fail, we will be released. If you succeed, we must return to our beauty rest until the next obnoxious bozo stumbles upon us.''
``Right, right. Challenge, uh-huh,'' I mumbled, still entering information on my notepad. ``There we go. What about an email address?''
``SILENCE MORTAL!'' yelled one of the other ancient gods.
``There is a labyrinth below this chamber,'' K'thalm'g'ra'tu continued, oblivious. ``We will provide you with a chariot. However, you may not leave the chariot and it only understands the ancient language Sc'm. You must speak to it, command it, to find your way out. That is your challenge, but you don't have much time, the deadly Blaarnog will be chasing you, and the chariot has only a limited amount of energy."
Another trap door was opened and I fell into an odd looking vehicle.
It was round, with a smaller round appendage in front. Inside there
was a bizzare looking terminal screen and a keyboard with
hieroglyphics on the keys. I hit a few keys and the screen came to life.
I quickly ascertained that Sc'm was actually a control language
similar to Scheme in most respects. I set about discovering the
functionality of my chariot, and quickly sent off a message to the home
office via my Newtons cellular email link:
The Project
Help! The world is doomed unless you can write some Scheme functions to guide my chariot through a labyrinth.
The chariot has the following capabilities:
You can not change this robot configuration.
Your robot must make use of these sensors and actuators. They are
defined in the file
proj2-defs.scm in the SIM folder. Your robot control
function must use the minimin procedure to plan ahead. Find the depth
that will return a move in under one minute. You may modify or
completely discard any of the code or representations written in
class.
The robot is already defined in the proj2-defs file. You
will need to provide a function called negotiate-maze which
should return either d, u, r, or l
indicating the direction the robot should move in. This
function will be called with three arguments: goal location, battery
level, and robot location, so that your function definition should
look like:
(define (negotiate-maze goal-loc battery-level robot-loc) ... )The two locations are specified as maze coordinates in a list of the form
(row col), where (0 0) is the upper
left corner, and in the first example maze, (7 11) is the
lower right corner. Note that the (row col)
notation is backward from the cartesian (x y)
notation.
Battery power is relevant in this project. If you waste too much time on false paths, you will run out of energy and be eaten by the deadly Blaarnog.
There are several global variables and functions you may (or may not) find useful:
*maze* is a vector of vectors (basically a
matrix). Each entry in the matrix contains a list of letters, as
discussed in class, indicating the valid directions to move from that
maze location. For example, (d u l) would mean that
there are no walls down, up or to the left of that position in the
maze.
To access the entry at location (row col) in
*maze*, you would use:
(vector-ref (vector-ref *maze* row) col)Note that to change the value in the matrix, you would use:
(vector-set! (vector-ref *maze* row) col value)You shouldn't be changing the
*maze* matrix, but you may
want, as discussed in class, to keep a matrix indicating where you've
been. The make-matrix function, described below, would
be helpful for setting that up.
*maze-size* is a list of the form
(cols rows), which contains the number of columns
and rows in the maze. Note that the number of columns or rows is one
more than the highest row or column number since the indexes begin at
zero.
*maze*
matrix is created with
(make-matrix (car *maze-size*) (cadr *maze-size*))
The robot has 4000 units of energy, and each move by the DURL motor costs 50 units, giving you 80 moves to finish the maze. You may want to keep track of the battery level and increase the depth of your minimin search when power gets low.
Be aware that the minimin function was updated on 10/16 to include a test that prevents searching the tree past the goal node. In order for this to work, your generate-sucessors function must return an empty list when passed a goal state (i.e. the goal state has no successors). Your heuristic function should return an absolute minimum value in this case (such as zero, however if you are making use of negative numbers in your heuristic then zero is not a minimum).
To run the simulator and initialize the *maze* matrix,
follow these steps:
Robot
Simulator icon in the SIM folder, and the
preloaded simulator will be launched. You should get Machscheme with a
SIM> prompt.
SIM directory.
proj2-defs.scm
(load-maze 1)
(map-maze). This will bring up
the maze and you will see the mapping robot ignore the walls and
traverse the maze. This takes about a minute. When it is complete,
you will see the word ready in the transcript window, and
the SIM> prompt will appear. At this point, the
*maze* matrix will be initialized with DURL lists.
(run), and if your robot works,
it will run.
Place a copy of the file containing your robot control function
in the drop box folder.
The file name must contain your last name and project number,
ie welty-2.scm.
Your robot control function must be well documented. Clearly annotate any changes you make to the code and representations developed in class.
The fastest robot to finish a test suite of mazes will win a prize.