Programming by Example

 

A BB4W Compendium

freeman69@gmx.com

IDIC BBC_Owl2 M&P

Lost Robot 9261 Competition

Lost Robot 9261: Challenge Summary

 

Communicate with a virtual robot by reading and writing to a plain text file, using the computer language of your choice in a Windows environment. The virtual robot is controlled by a program called RescueRobot.exe (see the Downloading section below).

 

For a demonstration:

 

1) Download the competition programs.

2) Open/run RescueRobot.exe

3) Open/run CommandEx.exe

4) Enter/paste the following string into the edit box of CommandEx.exe and click 'Execute':

 

RRRRFFFFLLLLLLBBBLLLLFFLFLLBLBBRRRRRRRRBRR

RescueRobot CommandEx

Lost Robot 9261: The Challenges

 

A prototype autonomous robot has been lost inside a 3 dimensional maze and the only practical way of locating and retrieving the machine is to explore the maze with a second robot, using remote control.

 

The player controls the Rescue Robot by writing a single character command, per turn, to a plain text file called BotCommand.txt. The contents of the file should be overwritten each turn, i.e. not added to.

The commands are F,B,L,R,U & D, i.e. directions: Forward, Backward, Left, Right, Up & Down.

 

The RescueRobot interface program reads a command, attempts to move the Rescue Robot and then writes a reply, to the same file, using a special code to describe the Rescue Robot's new location:

 

    '0000000' = Invalid move (direction blocked)/unrecognised command

    '1000000' = Robot can proceed forward

    '0100000' = Robot can proceed backward

    '0010000' = Robot can proceed left

    '0001000' = Robot can proceed right

    '0000100' = Robot can proceed up

    '0000010' = Robot can proceed down

    '0000001' = Lost robot has been located

 

Note: These are the ASCII characters zero and one and not a single byte value.

 

e.g. The string '1010000' would indicate that the robot can proceed forward or left.

 

The BotCommand file initially contains the value '1111000' because the robot begins at a crossroads.

 

The maze consists of 11 separated levels within a 21 x 21 x 21 unit cube. The Rescue Robot starts at the centre of the cube.

 

Communication is turn-based i.e. when the first character in the file is a zero or one then the message is for you. If the character is one of: F,B,L,R,U,D then the message is for the RescueRobot program. The RescueRobot program checks the text file around 10 times a second.

 

 

Finding the lost robot is the simple part of the exercise...

 

Challenge 'A' is to create a string of commands that will guide a Rescue Robot from the centre of the maze to the location of the lost robot. E.g. FFFRRRFFFLLBDD

Use the CommandEx program to test your solution.

 

Challenge 'B' is to discover the hexadecimal code hidden within the design of the maze. Hint: it will be necessary to create a map of the maze in order to find the code.

 

 

 

Rules:

 

This competition is open to Secondary schools in the UK.

 

Only one entry per school per 'challenge' is allowed.

 

The winning school(s) will be chosen randomly, from the pool of correct entries, to receive £200 per Challenge.

 

The competition closes on 31 August 2015. The winner(s) will be notified soon thereafter.

 

Entries must contain the name and address of the school, followed by your answer(s) to one or both challenges. The answer to 'A' should be less than 1000 characters in length.

 

Entries should be emailed to: freeman69@gmx.com

 

 

 

Downloading:

 

The RescueRobot competition program can be downloaded via this link

 

The optional CommandEx program can be downloaded via this link

 

Please note that some anti-virus software provide generic warnings in regard to small applications i.e. .exe files. While this site is dedicated to providing free open source code, this isn't a practical option under competition conditions. However, the source code will be made available after the competition closing date.

 

These programs were written under Windows 7 and should work on most versions of Windows (including Windows 98).

 

If your school outsources its IT then your provider should be able to download the program(s) for you.

BotCommand

           Competition now closed

 

Click here to download the solution pdf