Difference between revisions of "AP Computer Science"

From WLCS
(88 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Thursday (11/1/18) ==
+
== Tuesday (2/12/19) ==
* While loops quiz
+
'''Agenda:'''
* [https://docs.google.com/presentation/d/1GLpwZbqLcyix2WHqS9lLJT3qCeIeWGQ9UDwr6f9VgoE/edit?usp=sharing Search slides]
+
* Class construction, object usage, & object arrays quiz
** Linear Search
+
* Complete and demo War Card "Game"/Simulation
** Binary Search
+
** Display how many cards each player has at the beginning of each round
* LS and BS assignments will be posted in Repl.it
+
** You should display messages like "Player 1 reveals X of X"
* Complete LS and BS by Monday (11/5/18)
+
** Display a message of who wins each "round"
 +
** Display "I declare war!"
 +
** Display the eventual winner
  
== Tuesday (10/30/18) ==
+
== Wednesday - Friday (2/6/19 - 2/8/19) ==
 
'''Agenda:'''
 
'''Agenda:'''
* Demo missing assignments
+
* Complete and submit Poker Hands: Part 1 to repl.it
** Last assignment for quarter [[Looping Exercises]]
+
* Introduction to ArrayLists
* [https://docs.google.com/presentation/d/1GLpwZbqLcyix2WHqS9lLJT3qCeIeWGQ9UDwr6f9VgoE/edit?usp=sharing Search slides]
+
** AP CS reference card for ArrayLists
** Linear Search
+
** eIMACS ArrayLists chapter review
** Binary Search
+
** Memorize / study ArrayList<E> instance methods
* LS and BS assignments will be posted in Repl.it
+
* Processing - Ball example w/ ArrayLists
 +
* Processing - millis() timer example
 +
* Item Collection w/ ArrayLists
 +
*# Re-implement your Item Collection game so that it uses ArrayLists instead of arrays
 +
*# Start with an ArrayList of 1 robot, and add new robots every 3 seconds
 +
*# Start with an ArrayList of 5 items, and remove items when the player collides with them
 +
* ArrayList<Card> examples
 +
* War Card "Game"/Simulation
 +
*# Use NetBeans and create a new project for War
 +
*# The Main.java file will be the simulation
 +
*# Create a new Java class (name the file Card.java) and paste your Card class there
 +
*# Design and implement the game/simulation (we will design as a class)
  
== Friday (10/26/18) ==
+
== Monday (2/4/19) ==
 
'''Agenda:'''
 
'''Agenda:'''
* While loops quiz (on paper)
+
* Demo Item Collection Game w/ Object Arrays
* Demo [[Monte Carlo Calculation of Pi]]
+
* Complete Card class in repl.it (should be done today)
* Demo [[Taylor Series Pi and e]]
+
* Work on Poker Hands: Part 1 in repl.it - '''due Thursday (2/6/19)'''
* Complete [[Looping Exercises]]
 
  
== Wednesday (10/24/18) ==
+
== Thursday (1/31/19) ==
 
'''Agenda:'''
 
'''Agenda:'''
* Complete and demo [[Monte Carlo Calculation of Pi]] in Java
+
* Demo Item Collection Game
** You will need to use '''Math.random()''' to generate a random value between 0 and 1
+
* Arrays of Objects
* Complete and demo [[Taylor Series Pi and e]] in Java
+
** String arrays (review)
* Complete all the sequences in [[Looping Exercises]]
+
** Ball class and Ball array
 +
* Item Collection Game w/ Object Arrays (assignment)
 +
*# Copy your Item Collection Game to a new Processing sketch
 +
*# Convert your item Sprites collected into an array
 +
*# Convert your robot Sprites into an array
 +
*# Demo your converted game on '''Monday (2/4/19)'''
  
== Monday (10/22/18) ==
+
== Tuesday (1/29/19) ==
 
'''Agenda:'''
 
'''Agenda:'''
* Netbeans in App Catalog?
+
* Item Collection Game - '''due Thursday (1/31/19)'''
* Demo completed Tic-Tac-Toe game
+
*# We will design a simple top-down item collection game using a new Sprite class (specified below)
* Iteration - While Loops
+
*# Find and download Sprite images of your choosing
** Basic while loops
+
*# You can move the player sprite with the keyboard (wrap the player to the other side of the screen if you go off screen)
**# Write a loop that prints 0 to 10 (exclusive)
+
*# The player sprite will be able to collect item sprites
**# Write a loop that prints 10 to 0 (inclusive)
+
*# Robot sprites will follow the player around
**# Write a loop that sums all the numbers from 0 to 1000 (inclusive)
+
*# You win when you collect all the items
** While loops with strings
+
*# You lose if a robot collides with your sprite
**# Write a loop that prints each character of a String s (you supply the String's value)
+
* Sprite class (has similarities to the previous Sprite class)
**# Write a loop that prints every other character of a String s
+
** Attributes:
**# Write a loop that prints each character of a String s from end to beginning
+
*** double x, y (to be used for position)
** While loops with arrays
+
*** double dx, dy (to be used for step size when moving -- always positive)
**# Write a loop that prints every element of an int[]
+
*** PImage img (stores the image)
**# Write a loop that prints the square of every element in an int[]
+
*** boolean visible (default setting is true -- we will use this variable to track the Sprite's visibility state)
**# Write a loop that sums all the numbers of an int[]
+
** Constructors:
** Complete Test 6 and Test 7
+
*** Sprite()
 +
*** Sprite(String imgfile, double x, double y, double dx, double dy)
 +
** Methods:
 +
*** void display() - if visible is true, then display the image
 +
*** void moveLeft() - move x-coordinate to the left by dx amount
 +
*** void moveRight() - move x-coordinate to the right by dx amount
 +
*** void moveUp() - move y-coodrinate upwards by dy amount
 +
*** void moveDown() - move y-coodrinate downwards by dy amount
 +
*** boolean checkCollision(Sprite other) - returns true if this Sprite is colliding with the other Sprite (use previous Sprite class to help with this method)
 +
*** void follow(Sprite other) - compare x and y coordinates of this Sprite with the other Sprite -- move this Sprite towards other Sprite by using the move____() methods
  
== Thursday (10/18/18) ==
+
== Tuesday - Thursday (1/22/19 - 1/24/19) ==
 
'''Agenda:'''
 
'''Agenda:'''
* Demo Tic-Tac-Toe - Part 2
+
* [https://drive.google.com/file/d/1tQc3yOyfjy7xN6oz0glIeFHqJgORmuAd/view?usp=sharing Dino Game example]
* Tic-Tac-Toe - Part 3
+
** We will convert the non-OOP version into an [https://drive.google.com/file/d/1FAO7kdtVrYrrO4jgcRMap3S3UtDqFe_W/view?usp=sharing OOP version]
*# Add conditionals to check if any 3 locations match (make sure that at least one of the locations is not equal to the empty string)
+
** Add another cactus to the dino game
*# Display a text() message that indicates the winner
+
* Flappy Bird OOP
*# Call the noLoop() method to stop the game when there is a winner
+
** What modifications to our Sprite class do we need to make?
*# Implement a mechanism/conditional to check if the game is a draw (tie)
+
** Here are some Flappy Bird sprite images [https://drive.google.com/file/d/1UugFrLPjeA8YPXOlmOxjIvzd6HdvpupA/view?usp=sharing here]
* Demo a completed Tic-Tac-Toe game
+
** Implement the OOP version of Flappy Bird in Processing
* Challenge:
+
** Bird will need to flap when a key is pressed
*# Implement an AI to play against you
+
** Pipes will need to move and wrap around the screen
*# Design and implement [https://en.wikipedia.org/wiki/Ultimate_tic-tac-toe Ultimate/Super Tic-Tac-Toe]
+
** Score increases when a pipe is passed (this will require something to be added to the Sprite class)
 +
** Lose when bird collides with a pipe or when the Bird goes too far below the screen
 +
** Due '''Thursday (1/24/19)''' -- last assignment of 2nd Quarter
 +
 
 +
== Thursday (1/17/19) ==
 +
'''Warmup:'''
 +
* Submit your Circle class to repl.it
  
== Tuesday (10/16/18) ==
 
 
'''Agenda:'''
 
'''Agenda:'''
* Read [https://www.processing.org/reference/text_.html text()] and test it out to draw some text on the screen
+
* Object-Oriented Programming cont'd
* Read [https://www.processing.org/reference/mouseReleased_.html mouseReleased()] and test out the code
+
** OOP Review - attributes, constructors, setters, getters, public vs. private, this
* X-O clicker assignment
+
** toString() method (using the Point class)
*# Modify the code of the mouseReleased() so that a text-based X or O is drawn every time the mouse button is released
+
** Submit Point class to repl.it
* Work on and complete Tic-Tac-Toe - Part 2
+
** [https://docs.google.com/presentation/d/1hb_8wMUlQQl7W-JF2f3gax021yDHLkLENJYy0fUMGy8/edit?usp=sharing Classes (Java) slides]
*# Add a String variable to track the turn ("X" or "O")
+
* Complete the Car class assignments in repl.it
*# Add a two-dimensional String array to your Tic-Tac-Toe at the top to track the moves (all elements start as "", but will be "X" or "O" later)
+
* [https://drive.google.com/file/d/1tQc3yOyfjy7xN6oz0glIeFHqJgORmuAd/view?usp=sharing Dino Game example]
*# Implement the appropriate code in mouseReleased() to draw Xs and Os where the mouse button is released
+
** Add another cactus to the dino game
*# Make sure that you also have conditionals to check whether or not the location that is clicked is still empty (check against 2D array)
+
 
*# Make sure you update the 2-D String array with the current player's move
+
'''Homework:'''
*# Update the turn variable so that it switches (only with a successful move)
+
* Complete eIMACS: Activity 14: Address Objects
* Done with the above? Here are some challenges:
+
 
*# Implement a winner checking feature to stop the game and display who won
+
== Tuesday (1/15/19) ==
*# Implement an AI to play against you
+
* Snow Day
*# Design and implement [https://en.wikipedia.org/wiki/Ultimate_tic-tac-toe Ultimate/Super Tic-Tac-Toe]
 
  
== Friday (10/12/18) ==
+
== Friday (1/11/19) ==
 
'''Agenda:'''
 
'''Agenda:'''
* Activity 5 Questions?
+
* Object-Oriented Programming cont'd
* Test 5 Questions?
+
** Person class review
* mouseReleased()
+
** Vocab:
* Tic-Tac-Toe w/ Arrays
+
*** class vs object
*# Create a new Processing sketch
+
*** declaration vs instantiation
*# Copy over your TTT: Select-a-Square code
+
** Point class example
*# Add a two-dimensional String array to your Tic-Tac-Toe at the top
+
** Point object instantiation
*# Implement the appropriate code in mouseReleased() to draw Xs and Os (do as much as you can)
+
** Point object usage
 +
** [https://docs.google.com/presentation/d/1hb_8wMUlQQl7W-JF2f3gax021yDHLkLENJYy0fUMGy8/edit?usp=sharing Classes (Java) slides]
 +
** Circle class example
 +
** [https://drive.google.com/file/d/1tQc3yOyfjy7xN6oz0glIeFHqJgORmuAd/view?usp=sharing Dino Game example]
 +
 
 +
'''Homework:'''
 +
* Create a Circle class and test it out
 +
* Follow the [https://docs.google.com/presentation/d/1hb_8wMUlQQl7W-JF2f3gax021yDHLkLENJYy0fUMGy8/edit?usp=sharing Classes (Java) slides]
  
== Tuesday (10/9/18) ==
+
== Wednesday (1/9/19) ==
 
'''Agenda:'''
 
'''Agenda:'''
* [https://drive.google.com/open?id=1L-tbBp51YuUoTWldXFBr6JGcyHF5sBy_flfPGiqlVAQ Java methods overview]
+
* Cornell Engineering Diversity Programs - one-week residential programs:
* Complete and demo Tic-Tac-Toe Select-a-Square
+
** [https://sites.coecis.cornell.edu/catalystacademy/ Catalyst Academy] - juniors and seniors from underrepresented backgrounds
* Skim over eIMACS: Arrays chapter
+
** [https://sites.coecis.cornell.edu/curieacademy/ Curie Academy] - high school girls who excel in math and science
* Mr. Bui's [https://drive.google.com/open?id=1Ayzvd1q-6RwZKplUtLHDCCLyO5XIR5kyeKUi8-htErY Arrays (Java) slides]  
+
* Recursion quiz
* Complete Activity 5
+
* Submit Recursion Problems to repl.it
* Complete Test 5
+
** public static int count(String s, String ch) - returns the number of occurrences of ch (single character string) within s
 +
** public static String reverse(String s) - returns the reversed String s
 +
** public static int reverse(int i) - returns an int that is the full digit reversal of i (e.g. 1234 -> 4321)
 +
* Introduction to Object-Oriented Programming
 +
** [https://repl.it/@paulbui/SimpleProgramWithoutOOP Simple program without OOP example]
 +
** Simple program with OOP example
 +
** Point class example
 +
** Point object instantiation
 +
** Point object usage
 +
** [https://docs.google.com/presentation/d/1hb_8wMUlQQl7W-JF2f3gax021yDHLkLENJYy0fUMGy8/edit?usp=sharing Classes (Java) slides]
 +
** Circle class example
 +
 
 +
'''Homework:'''
 +
* Complete and submit recursion problems to repl.it
 +
* Review SimpleProgramWithOOP notes that we did in class
  
== Thursday (10/4/18) ==
+
== Monday (1/7/19) ==
'''Agenda:'''
+
* Don't forget to complete Activity 13 (due tonight)
* Take the Strings + Conditionals Quiz in Canvas
+
* Recursion Quiz Wednesday (1/9/19)
* Demo your first Processing drawing (it should also have your initials in the bottom right-hand corner)
+
** Multiple choice questions
* Introduction to Methods
+
** Free-response question(s)
** Intro to Processing methods
+
* Recursion Review & Practice
** Method calls
+
* Recursion Problems (prepare to submit to repl.it)
** Method parameters & arguments
+
** public static int count(String s, String ch) - returns the number of occurrences of ch (single character string) within s
*** Parameters are the variables in the method's definition header
+
** public static String reverse(String s) - returns the reversed String s
*** Arguments are the values used in the method call
+
** public static int reverse(int i) - returns an int that is the full digit reversal of i (e.g. 1234 -> 4321)
* Tic-Tac-Toe Select-a-Square
 
*# Setup your screen size to be a large square (e.g. 600x600)
 
*# Within the draw() function, give the background a color()
 
*# Draw tic-tac-toe lines on your screen (make sure that the rows and columns are exactly 1/3 the size of the height and width)
 
*# Add conditional statements in the draw() function to detect which square you are in
 
*#* You'll need to access the mouse's current coordinates with '''mouseX''' and '''mouseY''' variables
 
*#* Draw a square of a different color inside the particular square that you are in
 
*#* The effect that you will generate will look like it is highlighting the current square where the mouse is
 
*# Challenge: Modify your code so that changing the screen size, will automatically be adjusted and accounted for by the rest of your code. Hint: use '''height''' and '''width''' variables
 
*# Challenge2: Modify your code so that it works without any conditionals. Hint: Use division and multiplication
 
  
== Tuesday (10/2/18) ==
+
== Monday - Friday (12/31/18 - 1/4/19) ==
'''Agenda:'''
+
* Winter Break
* Questions on Activity 6: Airline meals?
 
* [https://processing.org/ Processing]
 
*# Download Processing
 
*# Drag-n-drop the program where you want to keep it
 
*# Check out the [https://www.processing.org/reference/ Processing documentation]
 
* My First Processing Drawing
 
*# Draw your initials in the bottom right-hand corner
 
*# Use Processing and method calls to draw your favorite emoji, logo, cartoon character, etc.
 
  
 
== Archives ==
 
== Archives ==
 +
* [[APCS - 1819 - December]]
 +
* [[APCS - 1819 - November]]
 +
* [[APCS - 1819 - October]]
 
* [[APCS - 1819 - September]]
 
* [[APCS - 1819 - September]]
 
* [[APCS - 1718]]
 
* [[APCS - 1718]]
 
* [[APCS - 1516]]
 
* [[APCS - 1516]]

Revision as of 07:03, 12 February 2019

Tuesday (2/12/19)

Agenda:

  • Class construction, object usage, & object arrays quiz
  • Complete and demo War Card "Game"/Simulation
    • Display how many cards each player has at the beginning of each round
    • You should display messages like "Player 1 reveals X of X"
    • Display a message of who wins each "round"
    • Display "I declare war!"
    • Display the eventual winner

Wednesday - Friday (2/6/19 - 2/8/19)

Agenda:

  • Complete and submit Poker Hands: Part 1 to repl.it
  • Introduction to ArrayLists
    • AP CS reference card for ArrayLists
    • eIMACS ArrayLists chapter review
    • Memorize / study ArrayList<E> instance methods
  • Processing - Ball example w/ ArrayLists
  • Processing - millis() timer example
  • Item Collection w/ ArrayLists
    1. Re-implement your Item Collection game so that it uses ArrayLists instead of arrays
    2. Start with an ArrayList of 1 robot, and add new robots every 3 seconds
    3. Start with an ArrayList of 5 items, and remove items when the player collides with them
  • ArrayList<Card> examples
  • War Card "Game"/Simulation
    1. Use NetBeans and create a new project for War
    2. The Main.java file will be the simulation
    3. Create a new Java class (name the file Card.java) and paste your Card class there
    4. Design and implement the game/simulation (we will design as a class)

Monday (2/4/19)

Agenda:

  • Demo Item Collection Game w/ Object Arrays
  • Complete Card class in repl.it (should be done today)
  • Work on Poker Hands: Part 1 in repl.it - due Thursday (2/6/19)

Thursday (1/31/19)

Agenda:

  • Demo Item Collection Game
  • Arrays of Objects
    • String arrays (review)
    • Ball class and Ball array
  • Item Collection Game w/ Object Arrays (assignment)
    1. Copy your Item Collection Game to a new Processing sketch
    2. Convert your item Sprites collected into an array
    3. Convert your robot Sprites into an array
    4. Demo your converted game on Monday (2/4/19)

Tuesday (1/29/19)

Agenda:

  • Item Collection Game - due Thursday (1/31/19)
    1. We will design a simple top-down item collection game using a new Sprite class (specified below)
    2. Find and download Sprite images of your choosing
    3. You can move the player sprite with the keyboard (wrap the player to the other side of the screen if you go off screen)
    4. The player sprite will be able to collect item sprites
    5. Robot sprites will follow the player around
    6. You win when you collect all the items
    7. You lose if a robot collides with your sprite
  • Sprite class (has similarities to the previous Sprite class)
    • Attributes:
      • double x, y (to be used for position)
      • double dx, dy (to be used for step size when moving -- always positive)
      • PImage img (stores the image)
      • boolean visible (default setting is true -- we will use this variable to track the Sprite's visibility state)
    • Constructors:
      • Sprite()
      • Sprite(String imgfile, double x, double y, double dx, double dy)
    • Methods:
      • void display() - if visible is true, then display the image
      • void moveLeft() - move x-coordinate to the left by dx amount
      • void moveRight() - move x-coordinate to the right by dx amount
      • void moveUp() - move y-coodrinate upwards by dy amount
      • void moveDown() - move y-coodrinate downwards by dy amount
      • boolean checkCollision(Sprite other) - returns true if this Sprite is colliding with the other Sprite (use previous Sprite class to help with this method)
      • void follow(Sprite other) - compare x and y coordinates of this Sprite with the other Sprite -- move this Sprite towards other Sprite by using the move____() methods

Tuesday - Thursday (1/22/19 - 1/24/19)

Agenda:

  • Dino Game example
    • We will convert the non-OOP version into an OOP version
    • Add another cactus to the dino game
  • Flappy Bird OOP
    • What modifications to our Sprite class do we need to make?
    • Here are some Flappy Bird sprite images here
    • Implement the OOP version of Flappy Bird in Processing
    • Bird will need to flap when a key is pressed
    • Pipes will need to move and wrap around the screen
    • Score increases when a pipe is passed (this will require something to be added to the Sprite class)
    • Lose when bird collides with a pipe or when the Bird goes too far below the screen
    • Due Thursday (1/24/19) -- last assignment of 2nd Quarter

Thursday (1/17/19)

Warmup:

  • Submit your Circle class to repl.it

Agenda:

  • Object-Oriented Programming cont'd
    • OOP Review - attributes, constructors, setters, getters, public vs. private, this
    • toString() method (using the Point class)
    • Submit Point class to repl.it
    • Classes (Java) slides
  • Complete the Car class assignments in repl.it
  • Dino Game example
    • Add another cactus to the dino game

Homework:

  • Complete eIMACS: Activity 14: Address Objects

Tuesday (1/15/19)

  • Snow Day

Friday (1/11/19)

Agenda:

  • Object-Oriented Programming cont'd
    • Person class review
    • Vocab:
      • class vs object
      • declaration vs instantiation
    • Point class example
    • Point object instantiation
    • Point object usage
    • Classes (Java) slides
    • Circle class example
    • Dino Game example

Homework:

Wednesday (1/9/19)

Agenda:

  • Cornell Engineering Diversity Programs - one-week residential programs:
  • Recursion quiz
  • Submit Recursion Problems to repl.it
    • public static int count(String s, String ch) - returns the number of occurrences of ch (single character string) within s
    • public static String reverse(String s) - returns the reversed String s
    • public static int reverse(int i) - returns an int that is the full digit reversal of i (e.g. 1234 -> 4321)
  • Introduction to Object-Oriented Programming

Homework:

  • Complete and submit recursion problems to repl.it
  • Review SimpleProgramWithOOP notes that we did in class

Monday (1/7/19)

  • Don't forget to complete Activity 13 (due tonight)
  • Recursion Quiz Wednesday (1/9/19)
    • Multiple choice questions
    • Free-response question(s)
  • Recursion Review & Practice
  • Recursion Problems (prepare to submit to repl.it)
    • public static int count(String s, String ch) - returns the number of occurrences of ch (single character string) within s
    • public static String reverse(String s) - returns the reversed String s
    • public static int reverse(int i) - returns an int that is the full digit reversal of i (e.g. 1234 -> 4321)

Monday - Friday (12/31/18 - 1/4/19)

  • Winter Break

Archives