Upload
others
View
7
Download
0
Embed Size (px)
Citation preview
Pa1: Turtles
Due Thursday, September 29th by 11:59pm
Getting Started with Pa11. Make a new directory and name it ‘pa1’
2. Copy over turtles.jar from the public directory
3. Only ONE required file to turn in
○ CS11TurtleGraphics.java
4. READ THE WRITEUP THOROUGHLY
○ Chances are the answers to 90% of the questions you have are in the writeup
The assignment:Draw out your login, year, and school using Turtles!
● You will be using methods from SimpleTurtle
○ CSE11 Website->Useful Links->turtleClassesDocs->SimpleTurtle
Specifics:● World is 1080x480 pixels● Each character should be 40x80 pixels● Should be 40 pixels of space between characters
and between lines of text● Top left corner of first letter is at position
(40,40)
Example Output:
Use your own login!
Approach● TYPE out all the code given on the writeup
● Start your main method.
● Write each needed letter method individually.
● Test your program after each letter is written
to ensure it is working how you expect.
Example Letter Methodprivate void drawC(int x, int y) { penUp(); moveTo(x, y); // always start in upper left corner of this char block turnToFace(getXPos() + 1, getYPos()); // face right penDown(); forward(40); penUp(); backward(40); turnRight(); penDown(); forward(80); turnLeft(); forward(40);}
What is this code doing??
***Do not hardcode numbers like above! Use constants!
More Helpful Tips ● turnLeft() and turnRight() vs. actually
turning left and right
● Turtle must face in direction it is going to draw
● Draw out characters by hand on paper before coding
Right Left
Woah cool extra credit!Center Text Vertically and Horizontally
● How do we do this??○ World is 1080 pixels wide (this example is for horizontal centering)○ Each char and interchar spacing is 40 pixels… ○ How many spacings do we have total?○ How many spacings do we use for chars and interchars?○ How many spacings do we need on both sides of the centered line?
***Make sure you implement your extra credit in a new file called
CS11TurtleGraphicsEC.java
MOAR Extra CreditAdd color and draw something cool! Be creative! Dazzle us with your masterful artistry!
Awkward!! We didn’t tell you how to do the assignment
Getting Your Account● First, check your login ID on ACMS
○ https://sdacs.ucsd.edu/~icc/index.php
○ Scroll down under “Resources” and locate the username beginning with “cs11f”
● Then, you MUST reset the password of this account using the password reset tool
○ http://acms.ucsd.edu/students/gpasswd.html○ Enter the username you just found starting with “cs11f” and your PID
number.○ It may take some time to take effect. Be patient! (And make sure you
don’t do this Thursday night)
***DO THIS FIRST!
Logging In● All labs in the CSE Basement are open 24/7
○ Our home base lab is B240○ If ever prompted to choose an operating system, use CentOSX○ Login using your cs11f account (from previous page)
● To work remotely, you will need to SSH into the UCSD Server. ○ There will be a Piazza post with more information on this
Using the TerminalUse the terminal!
To open the terminal, right click on the Desktop and click (“Open in Terminal”)
A few basic unix commands:- mkdir- cd- ls- vim- man
CSE11 Website->Useful Links->Unix Tutorial
Using Vim● You should be using vim or gvim as your text editor● Some resources:
○ CSE11 Website -> Useful Links -> Vi Cheatsheet ● We also recommend setting up a vimrc file :)
○ You’ll learn more about these in cse 15l but for more info now, consult Google! (or piazza or tutors)
Getting HelpTwo main ways of getting help:
1. Go to the Lab a. To get help from tutors, use autograder.ucsd.edub. Login with your UCSD email credentials
2. Use piazza.coma. Online forum to communicate with tutors, fellow students, and
sometimes Rick!
Preliminary Tutor Hourshttps://docs.google.com/spreadsheets/d/1u3kY03-FppHJpB3hl_yw5U9cLuis2LdUK4bLV7mc16Y/htmlview
Do’s and Don’ts of PiazzaDO:
● Search for your question before
posting, another student might
have had the same one!
● Ask questions to clarify
information about the assignment
● Ask how to approach solving
certain problems
● Help other students!
DON’T:
● Ask for answers (to previous
quizzes, midterms, finals)
● Post answers (to previous quizzes,
midterms, finals)
● Post code or really specific
pseudocode
● Post duplicate questions (it’s ok if
it happens but try to avoid this)
Running and Compiling Your Program● To compile:
○ javac -cp ./turtleClasses.jar:. CS11TurtleGraphics.java
● To run: ○ java -cp ./turtleClasses.jar:. CS11TurtleGraphics
● Notice you don't type .java or .class to run your program
Turning In Your Assignment● Make sure to always recompile and run your program before
turning it in! Even a small code change can significantly affect how your program runs!
● To turnin: ○ cse11turnin pa1
● To verify turnin: ○ cse11verify pa1
Some Logistics● How to get help in the lab? autograder.ucsd.edu ● How to request a regrade? Email your grader. ● What happens if your grader doesn’t respond back in 5
days? Post followups on Piazza. ● Find ambiguity/bugs in assignment writeups? Post on
Piazza. ● Rule of Piazza: If you resolve your own question, post
the answer.● Regrade on quizzes/midterms? Visit Rick’s office hours.
Style!● Include comments, file headers, and
class/method headers● Use meaningful variable names.● Use blank lines. Separate code into
logical chunks.● Limit each line to 80 chars● Use camelCase. (E.g. myClass, myMethod)● Indent properly. Use 2-4 spaces, no
tabs!● No Magic Numbers (any number other than
0 or 1).● No commented-out code (this might
happen during coding, but should be removed before turning it in).
Typically worth ~20% of your programming assignment grade! (Free
Points!)
goesGood style
How To Succeed!DO:
● USE VIM
● Start early
● Read turtleclasses docs
● Ask EARLY for help from tutors
● Go to lectures / Take notes
● Go to discussions
● READ INSTRUCTIONS
(thoroughly)
● Make friends and form a study
group!
DO NOT:
● USE Eclipse, DrJava, any other
IDEs - we will know if you do
● Start the night before the assignment
is due
● Skip reading docs
● Ask tutors for the answers (instead
ask for suggestions)
● Neglect style
● Copy other students’ code
Few Notes About Lab Etiquette ● It gets crowded. Don’t waste time on Facebook, World of
Tanks, etc. and avoid claiming a seat and leaving. ● Don’t blast music or be obnoxiously loud.● Don’t eat smelly foods. (Related, maintain some standard
of personal hygiene.)● Bottom line, the lab is a community space meant for all
students to share. Be respectful of your fellow students.
Always Remember:Start early and Start OFten!
Any Questions?