Chapter 4 To index
Haski the Robot

Now that you have learned all important things about Haski in the first three chapters, you can try to solve some problems on your own.

The maze

Some robots are trapped inside a maze, we want to help them escape. All we know is that all walls are connected to the outer border in some way, i.e. there are no 'free-floating' walls. In order to allow a robot to detect when it has found the way out of the maze, the exit is 'marked' with some items on the respective field. The mapfile is called, you can find a possible solution in maze.hs -- but first try to solve it yourself! Hint: Stick to the walls...

The Warehouse

Here the robot has the task to clear up a warehouse (mapfile The warehouse consists of a long hallway (of differing length) with some space for goods to the left and the right of each field. The first, basic task for the robot will be to go through the warehouse and put all single items to the right and all pairs of items to the left (possible solution in warehouse.hs).

For a more advanced version we add the following requirement: After putting all items in their proper places the robot has to leave the warehouse again and stop in front of the entrance as shown below:

You can again compare your solution (hint: recursion!) to the one in warehouse-rec.hs.

Back to the index

by Lars Otten, 2004