Assignment 0: Robot¶
Objective¶
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.
Assignment Setup¶
Before starting this assignment it is expected that you have completed the software setup for the course as well as Studio 0)
To create your repository go go here. Then follow the same accept/import process described in the setup instructions.
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).
Expand the
assignment-00
folder.Expand the
src
folder.Expand the
assignment0
folder 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, selectingRun As
, and then selectingJava Application
, like:
A new window should now open. Click on the
Go
button and you’ll see a simulated robot draw on the screen. It’s merely following the instructions that are being given in theRobotInstructions.java
that 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 therobot.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 thePlay
button 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 sayrobot.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
Proceed
button.Put the semi-colon back in and correct the errors.
Add a new, empty line after a
robot.forward
line. Typerobot
then.
. 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 flower or a tree (maybe a leaf?). Be creative!
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:
Know where to go to find Office Hours, which will be posted by the second week of class.
Know how to browse the content and prepare for modules.
Be sure you’re signed up for the course’s Piazza forum.
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!