Articles in the Courses Category
2011 APCS »
Thanks to Dave Ruth from Niles North High School!
You will implement a game of Snake using GridWorld! A bug will represent the head of the snake and its body will be an ArrayList of rocks. Its goal will be to eat a flower. You will start with the SnakeGame.java client which controls the snake with user input. Eventually, your game will look like this:
Create a class called SnakeBug that extends class Bug. Your bug needs to keep track of two pieces of information: how much it needs to grow by and …
2011 APCS »
You will complete the Jumper class as detailed in the GridWorld case study part 3 document (make sure to read through it before beginning). This actor can move forward two cells in each move. It “jumps” over rocks and flowers. It does not leave anything behind it when it jumps.
NOTE: a Jumper can’t use the same canMove and move methods as a Bug. That implies it is a sibling of a Bug.
Use the specifications below. When you get checked off, you will need to efficiently show that you’ve addressed each case. That …
2012 Spring Intro to CS »
You will turn in any three of these to demonstrate that you know how to use parameters, expressions, types and user input.
Write each function with parameters and then call them using values from user input. They’re ordered roughly by difficulty, so if you feel confident, skip the ones at the top!
Activity 1: Length conversion
Given a length in centimeters, convert into inches. There are 2.54 cm in an inch. For example, given a parameter value of 10, your function should print something like “10 centimeters is 3.937 inches.” When you add user …
2011 APCS »
GridWorld is your AP case study. It’s a great opportunity to get familiar with a larger code base and see an example of well-designed object-oriented code at work. I hope you’ll have fun working with it, too! (If you run into problems, consult the AP GridWorld Installation Guide )
Getting the files
Download a zip file of the Gridworld code.
Extract all the files from the Gridworld archive into your computer science folder
JGrasp
You’ll need to add the Gridworld jar file to your CLASSPATH. Follow these images (click on to enlarge):
Exploring GridWorld
Read through the first part …
2012 Spring Intro to CS, Uncategorized »
Make sure you have read and understood the notes on for changing parameter values in loops before starting these!
Please focus and challenge yourself throughout the period. You only need to complete one for credit that I will check off but I expect you to attempt as many as you can.
Activity 1: Growing stars
Reuse your parameterized Star function:
Activity 2: Square spiral
Your spiral function should have the following parameters:
number of repetitions (“size”)
spacing between repetitions (“tightness”)
x position of the center
y position of the center
Activity 3: Round spiral
Same as activity 1, but rounded! (lots …
2012 Spring Intro to CS »
You should now feel comfortable with basic turtle graphics functions, defining your own functions, the print function and using for loops for repetition.
The variable “i” in the loop:
Recall the “variables” we created in Scratch to track the changing score of the pong game or size for geometric shaps? Well a loop defined with the code for i in range(<num>) has a variable ”i” that varies in value as the loop is executed. The first time through the loop i at 0 and then increases by one until it equals the range number then it …
2011 APCS »
You will implement a class to represent weights in pounds and ounces. Your class will have two fields: pounds and ounces. Recall that there are 16 ounces in a pound. Your Weight objects should never keep track of more than 15 ounces, they should convert the value to pounds instead (i.e. 2lb 17oz should become 3lb 1oz). Weights needs its toString method, ex: 1lb 4oz or 3oz or 7lbs 3oz. In addition, your class will implement the Comparable interface to define how they are sorted (lighter to heavier). Write a client that creates several weights, puts them …
2012 Spring Intro to CS »
Turtle Graphics Shapes Project – worth 20 points.
You will be turning in a single file with all of the activities. Here is how I will grade what you turn in:
(__/2pts) – has pinwheel function
(__/2pts) – has star function
(__/2pts) – has sunburst function
(__/3pts) – all three shape functions have a size parameter (for example, calling star(10) draws a star twice as big as calling star(5))
(__/3pts) – has letter function
(__/3pts) – has programmer’s choice function
(__/1pt) – all functions called
(__/1pt) – all function definitions at top and calls at bottom
(__/1pt) – comment with …
2012 Spring Intro to CS »
15 Classwork Points. You will draw a house using turtle graphics. Divide it into functions (ex: roof(), door()) and to embellish it: add windows, etc.
Make sure that your house:
looks like some sort of building
each section uses a function (draw_door, draw_window…)
at least one function used more than once (draw multiple windows or multiple flowers in front of the house or something)
at least one interesting detail (door knob, intricate windows, smoke out of the chimney…)
creativity (use of color, intricate shape, cool design…)
Take a look at examples from last year to inspire you:
(Assignment …
2012 Spring Intro to CS »
Writing programs is perfect for generating regular shapes for a cool logo or something of the sort. These exercises will help you gain spacial reasoning skills while letting you be a little creative. Check out what students came up with last semester. Make sure you write each shape in its own function so you can reuse it! Be sure to play with color, pen thickness, positioning and so on. These should all be in a file called shapes.py. This project is worth 20 Points and will be graded using this …



