Difference between revisions of "AP Computer Science"

From WLCS
Line 11: Line 11:
 
*# 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 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
 
*# 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)
  
 
== Friday (10/12/18) ==
 
== Friday (10/12/18) ==

Revision as of 05:52, 16 October 2018

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
    1. 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
    1. Add a String variable to track the turn ("X" or "O")
    2. 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)
    3. Implement the appropriate code in mouseReleased() to draw Xs and Os where the mouse button is released
    4. Make sure that you also have conditionals to check whether or not the location that is clicked is still empty (check against 2D array)
    5. Make sure you update the 2-D String array with the current player's move
    6. Update the turn variable so that it switches (only with a successful move)

Friday (10/12/18)

Agenda:

  • Activity 5 Questions?
  • Test 5 Questions?
  • mouseReleased()
  • Tic-Tac-Toe w/ Arrays
    1. Create a new Processing sketch
    2. Copy over your TTT: Select-a-Square code
    3. Add a two-dimensional String array to your Tic-Tac-Toe at the top
    4. Implement the appropriate code in mouseReleased() to draw Xs and Os (do as much as you can)

Tuesday (10/9/18)

Agenda:

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
    1. Setup your screen size to be a large square (e.g. 600x600)
    2. Within the draw() function, give the background a color()
    3. 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)
    4. 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
    5. 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
    6. 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
    1. Download Processing
    2. Drag-n-drop the program where you want to keep it
    3. Check out the Processing documentation
  • My First Processing Drawing
    1. Draw your initials in the bottom right-hand corner
    2. Use Processing and method calls to draw your favorite emoji, logo, cartoon character, etc.

Archives