pa1: turtles

24
Pa1: Turtles Due Thursday, September 29th by 11:59pm

Upload: others

Post on 29-May-2022

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Pa1: Turtles

Pa1: Turtles

Due Thursday, September 29th by 11:59pm

Page 2: Pa1: Turtles

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

Page 3: Pa1: Turtles

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)

Page 4: Pa1: Turtles

Example Output:

Use your own login!

Page 5: Pa1: Turtles

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.

Page 6: Pa1: Turtles

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!

Page 7: Pa1: Turtles

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

Page 8: Pa1: Turtles

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

Page 9: Pa1: Turtles

MOAR Extra CreditAdd color and draw something cool! Be creative! Dazzle us with your masterful artistry!

Page 10: Pa1: Turtles

Awkward!! We didn’t tell you how to do the assignment

Page 11: Pa1: Turtles

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!

Page 12: Pa1: Turtles

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

Page 13: Pa1: Turtles

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

Page 14: Pa1: Turtles

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)

Page 15: Pa1: Turtles

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!

Page 17: Pa1: Turtles

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)

Page 18: Pa1: Turtles

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

Page 19: Pa1: Turtles

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

Page 20: Pa1: Turtles

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.

Page 21: Pa1: Turtles

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

Page 22: Pa1: Turtles

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

Page 23: Pa1: Turtles

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.

Page 24: Pa1: Turtles

Always Remember:Start early and Start OFten!

Any Questions?