AP Computer Science
From WLCS
Contents
Monday (11/5/18)
Warmup:
- Assume you have a given array named arr
- Assume you have two int variables named a and b
- Write the code that would swap the elements in arr located at indices a and b
- e.g. swap the elements arr[a] and arr[b]
Agenda:
- Complete the Find Minimum & Maximum repl.it
- Group sorting activity
- Form 3-4 person groups
- Receive playing cards
- With your group, document step-by-step an algorithm (steps) of how you sort the cards out
- Every group will share their algorithm in class
- Introduction to Sorting
- Complete Selection sort assignment in repl.it
Thursday (11/1/18)
- While loops quiz
- Search slides
- Linear Search
- Binary Search
- LS and BS assignments will be posted in Repl.it
- Complete LS and BS by Monday (11/5/18)
Tuesday (10/30/18)
Agenda:
- Demo missing assignments
- Last assignment for quarter Looping Exercises
- Search slides
- Linear Search
- Binary Search
- LS and BS assignments will be posted in Repl.it
Friday (10/26/18)
Agenda:
- While loops quiz (on paper)
- Demo Monte Carlo Calculation of Pi
- Demo Taylor Series Pi and e
- Complete Looping Exercises
Wednesday (10/24/18)
Agenda:
- Complete and demo Monte Carlo Calculation of Pi in Java
- You will need to use Math.random() to generate a random value between 0 and 1
- Complete and demo Taylor Series Pi and e in Java
- Complete all the sequences in Looping Exercises
Monday (10/22/18)
Agenda:
- Netbeans in App Catalog?
- Demo completed Tic-Tac-Toe game
- Iteration - While Loops
- Basic while loops
- Write a loop that prints 0 to 10 (exclusive)
- Write a loop that prints 10 to 0 (inclusive)
- Write a loop that sums all the numbers from 0 to 1000 (inclusive)
- While loops with strings
- Write a loop that prints each character of a String s (you supply the String's value)
- Write a loop that prints every other character of a String s
- Write a loop that prints each character of a String s from end to beginning
- While loops with arrays
- Write a loop that prints every element of an int[]
- Write a loop that prints the square of every element in an int[]
- Write a loop that sums all the numbers of an int[]
- Complete Test 6 and Test 7
- Basic while loops
Thursday (10/18/18)
Agenda:
- Demo Tic-Tac-Toe - Part 2
- Tic-Tac-Toe - Part 3
- 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)
- Display a text() message that indicates the winner
- Call the noLoop() method to stop the game when there is a winner
- Implement a mechanism/conditional to check if the game is a draw (tie)
- Demo a completed Tic-Tac-Toe game
- Challenge:
- Implement an AI to play against you
- Design and implement Ultimate/Super Tic-Tac-Toe
Tuesday (10/16/18)
Agenda:
- Read text() and test it out to draw some text on the screen
- Read mouseReleased() and test out the code
- X-O clicker assignment
- Modify the code of the mouseReleased() so that a text-based X or O is drawn every time the mouse button is released
- Work on and complete Tic-Tac-Toe - Part 2
- Add a String variable to track the turn ("X" or "O")
- 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)
- Implement the appropriate code in mouseReleased() to draw Xs and Os where the mouse button is released
- 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
- Update the turn variable so that it switches (only with a successful move)
- Done with the above? Here are some challenges:
- Implement a winner checking feature to stop the game and display who won
- Implement an AI to play against you
- Design and implement Ultimate/Super Tic-Tac-Toe
Friday (10/12/18)
Agenda:
- Activity 5 Questions?
- Test 5 Questions?
- mouseReleased()
- Tic-Tac-Toe w/ Arrays
- Create a new Processing sketch
- Copy over your TTT: Select-a-Square code
- Add a two-dimensional String array to your Tic-Tac-Toe at the top
- Implement the appropriate code in mouseReleased() to draw Xs and Os (do as much as you can)
Tuesday (10/9/18)
Agenda:
- Java methods overview
- Complete and demo Tic-Tac-Toe Select-a-Square
- Skim over eIMACS: Arrays chapter
- Mr. Bui's Arrays (Java) slides
- Complete Activity 5
- Complete Test 5
Thursday (10/4/18)
Agenda:
- Take the Strings + Conditionals Quiz in Canvas
- Demo your first Processing drawing (it should also have your initials in the bottom right-hand corner)
- Introduction to Methods
- Intro to Processing methods
- Method calls
- Method parameters & arguments
- Parameters are the variables in the method's definition header
- Arguments are the values used in the method call
- 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)
Agenda:
- Questions on Activity 6: Airline meals?
- Processing
- Download Processing
- Drag-n-drop the program where you want to keep it
- Check out the 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.