Assignment 0: Robot¶
The assignment is intended to make sure that you’ve completed the setup materials necessary for the course, and get you some practice with demoing your work.
Using Java to Control a Robot¶
Your project should now be open in Eclipse. You should have a pane called the Package Explorer on the screen (if not, go to the Window menu, select Show View and pick Package Explorer).
assignment0folder and double click on the RobotInstructions.java file. It should look something like this:
Run the other file, the
RobotController.java, by right-clicking on it, selecting
Run As, and then selecting
Java Application, like:
A new window should now open. Click on the
Gobutton and you’ll see a simulated robot draw on the screen. It’s merely following the instructions that are being given in the
RobotInstructions.javathat you opened.
Close the robot simulation window (not Eclipse).
Review the contents of
RobotInstructions.java, which should be shown in Eclipse. Make some changes: 1. Change the
robot.forward(60);to robot.forward(120);. What do you think the robot will do differently? 2. Run the robot simulator again. Now that you’ve configured Eclipse to run it, you can just select the
Playbutton on the menu:
Did the robot do what you expected?
What if you removed the line that now says
robot.forward(120);and replaced it with two lines that each say
robot.forward(60);? Before making any change be sure to close the simulator. Then make your changes and hit the Play button to see their impact.
Try removing a semi-colon (
;). Eclipse should add red indicators in several places indicating there are errors with the file. These are helpful cues that you should pay attention to in larger programs. The circles in this picture show all the special indicators, which help programmers find the exact locations of this type of problem:
Try running the program with errors. Eclipse should show a window warning you. Do not hit the
Put the semi-colon back in and correct the errors.
Add a new, empty line after a
.. Notice that when you hit the
.a window appears with a list of options. Eclipse is letting you know the choice available to you here. This is one benefit of using an IDE like Eclipse.
Experiment with changing / adding other commands.
Working With Code¶
Now that you understand how to use Eclipse to modify and run the program, spend some time making the robot draw a picture of a house.
2. Commit and push your work¶
Follow the instructions from studio 0 to commit and push your work.
After doing Commit and Push always check your work on GitHub. Go to the course page on GitHub, select the respository for the assignment, and then review the individual files.
The TAs will be asking you some questions about GitHub (and debugging) as part of the submission process, so be sure to review the content of studio 0 before submitting this assignment.
3. Course Information¶
Review the course site on Canvas. Make sure you review:
4. “Demo” your work to a TA!¶
To receive credit for an assignment in this course you must demo your work to an instructor or a TA. The person demoing you will walk you through the rubric for the assignment, which can be found on Canvas. It is a good idea to take a look at the rubric yourself and make sure that all parts of the assignment are completed before starting a demo!
Show the TA your work
Show them your final work on GitHub.
Ask any questions you have about the course.
Confirm that your score is recorded in Canvas. Mistakes can happen and you should always confirm credit is recorded before leaving class!