For this project, you will be giving a set of directions to a robot named sam. This robot is sitting in a room but he left his beeper outside. He needs to go get the beeper and bring it back into his house. Your task is to write a set of directions (a program) which sam can follow to complete this task.
To get started, open this link in another tab (https://codehs.com/sandbox/id/sam-the-robot-6wII5G ). You can ignore most of the stuff that comes up on this page for now, but you will be writing your directions for sam in the middle of the page between the two green lines. Before doing that, hit the green "RUN" button on the right side of the page to see a visual of the situation.
There are four things you can tell sam to do in your program:
move() - move sam one spot forward on the grid in the direction he is facing
turnLeft() - turn sam 90 degrees to the left [sam used to work with NASCAR so he does not know how to turn right]
pickBeeper() - if sam is on the same spot as a beeper, he will pick up the beeper
putBeeper() - if sam is carrying a beeper, he will set it down on the ground.
When you want sam to do one of these tasks, you must call him by name. Most commands in java need a semi-colon at the end, so if you want sam to move, you must type:
sam.move();
If you want sam to turn, you must type:
sam.turnLeft();
Once you have written your directions (or part of them), hit the green RUN button on the right side of the screen to see what happens!
A few notes which might be helpful:
Be very careful with your spelling and capitalization! These matter in java. If you write 'Sam' instead of 'sam' or forget a semi-colon or something, your code will not work and you will see an error message in the bottom right corner under the map. The error message might not make sense yet, but it will show you where the error is in your code.
You are going to write some lines several times. Feel free to write "sam.move();" once and copy paste it as needed.
If you try to do something that will not work (like walk through a wall or pick up a beeper in a space that does not have one), your program still stop at that point and not continue. You will have to change your code and try again!
To finish this assignment, please call over Mr. Borish and show him your robot standing in the house with the beeper next to him. If you have completed the task successfully, it should look something like this (https://drive.google.com/file/d/1amLnRYFZuH45HsLf9oCUHKHUeTPdPC7P/view?usp=sharing ) but without my name.