|
When you write a program, you can tell the computer what to do, step by step.
But sometimes, the action of the computer depends on the situation. A good
example is the following (familiar) button. IF the person clicks YES, --> then the page will be saved. Computers are good in choices with two options. They are very simple to follow. When more than two choices are necessary, you need to write more IF statement with two choices: A series of commands for a screen saver would look something like this: Number 3,4 and 6are IF commands. At that time, the computer checks for input and acts according to its instructions. GETTING OUT OF A ROOM
There is a robot in a square room. There is one door opening in the room, but you do not know exactly where. Write a program so the robot will always find the door, regardless it's starting position. The computer can sense if there is a wall next to her or in front of her. ("FEEL"). She can turn any direction ("TURN), default 90°. And she can take a step forward (STEP) For the answer (click here)
|