Difference between revisions of "IB Computer Science 1"
From WLCS
(→Tuesday (10/15/19)) |
|||
Line 1: | Line 1: | ||
+ | == Friday (10/18/19) == | ||
+ | '''Agenda:''' | ||
+ | * Prepare to demo [https://docs.google.com/document/d/1i6iUV20KXDF_yKr4mn5X4JQQPc4hF7lklkp5DlDpMCE/edit?usp=sharing Functions: Hover Buttons] next class | ||
+ | * More advanced mouse variables and functions: | ||
+ | ** Complete the table found in [https://docs.google.com/document/d/1wfVoej_7PVHquaAcugEr5YWZIzbKPNl8YYKlp7Gfouo/edit?usp=sharing Mouse Variables & Functions] | ||
+ | ** Complete the Part 2 activity in [https://docs.google.com/document/d/1wfVoej_7PVHquaAcugEr5YWZIzbKPNl8YYKlp7Gfouo/edit?usp=sharing Mouse Variables & Functions] | ||
+ | * Complete [https://docs.google.com/document/d/1xRSA_Ti8l5002jcAftcUtCTdujCojghzoTpUZwJvHQ4/edit?usp=sharing Bouncing Ball] | ||
+ | * We will combine our new mouse knowledge with the bouncing ball lab to create a simple pool program that uses the mouse to control hitting a ball to hit another ball | ||
+ | *# Create a ball on the screen | ||
+ | *# When the mouse is clicked, you should draw a green line from the middle of the ball to the mouse pointer | ||
+ | *# Releasing the mouse changes the ball's velocity (dx, dy) using the difference between (x, y) and (mouseX, mouseY) | ||
+ | |||
+ | == Wednesday (10/16/19) == | ||
+ | * PSATs | ||
+ | |||
== Tuesday (10/15/19) == | == Tuesday (10/15/19) == | ||
'''Agenda:''' | '''Agenda:''' |
Revision as of 15:12, 17 October 2019
Contents
Friday (10/18/19)
Agenda:
- Prepare to demo Functions: Hover Buttons next class
- More advanced mouse variables and functions:
- Complete the table found in Mouse Variables & Functions
- Complete the Part 2 activity in Mouse Variables & Functions
- Complete Bouncing Ball
- We will combine our new mouse knowledge with the bouncing ball lab to create a simple pool program that uses the mouse to control hitting a ball to hit another ball
- Create a ball on the screen
- When the mouse is clicked, you should draw a green line from the middle of the ball to the mouse pointer
- Releasing the mouse changes the ball's velocity (dx, dy) using the difference between (x, y) and (mouseX, mouseY)
Wednesday (10/16/19)
- PSATs
Tuesday (10/15/19)
Agenda:
- Group 4 Project permission slips
- Function definitions & return repl.it questions?
- Demo your completed Tic-Tac-Toe: Part 3 if you have not already done so
- Tic-Tac-Toe w/ Functions walk-through
- Complete and demo Functions: Emoji Assignment
- Work on Functions: Hover Buttons
Homework:
- Complete Functions: Hover Buttons
Thursday (10/10/19)
Agenda:
- Group 4 Project permission slips
- Demo your completed Tic-Tac-Toe: Part 3
- Introduction to Functions
- Complete repl.it assignment titled: "Function definitions & return"
- Work on Functions: Emoji Assignment
Homework:
- Complete "Function definitions & return" repl.it assignment if you did not do so in class
Tuesday (10/8/19)
Agenda:
- Group 4 Project permission slips
- Complete & demo Tic-Tac-Toe - Part 2
- Tic-Tac-Toe - Part 3
- Be sure to create a new sketch so as not to lose your working Part 2 code, and copy over your Part 2 code to the new sketch
- Add if-statements and conditionals to check if any 3 in a row match
- Don't forget to make sure that one of the slot variables is not equal to the empty string because 3 empty slots will be considered a match too
- Display a text() message that indicates the winner
- Call the noLoop() function 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
Friday (10/4/19)
Agenda:
- Group 4 Project - field trip slips
- Complete and demo Tic-Tac-Toe: Part 2 (see description from Wednesday)
- If you have completed Tic-Tac-Toe: Part 2, then proceed to adding conditionals to determine winning
- Don't forget about cat's games (tie-game) where the board is completely full
Wednesday (10/2/19)
Agenda:
- Demonstrate Tic-Tac-Toe Select-a-Square
- Read text() and test out its example code snippet
- You can use text() to draw X and O on the screen for our game!
- Read global variables and test out its example code snippet in Processing
- You will interact with the code snippet by hitting keys
- Focus on understanding the use of the global keyword
- Read mouseReleased() and test out its example code snippet in Processing
- You will interact with the code snippet by pressing and releasing the mouse/trackpad button
- The mouseReleased() function automatically runs every time the mouse's button is released
- What components of Tic-Tac-Toe are left?
- Copy your Tic-Tac-Toe code to a new Processing sketch program and save it as TTT_Part2
- Declare/create a global string variable named turn and initialize it to either "X" or "O"
- Declare/create global variables for each square in the game (e.g. b_0_0, b_0_1) -- you will use these variables to track where moves are made
- Initialize all the b_#_# variables to empty strings ""
- Update your draw() so that all of the b_#_# variables are text()-ed onto the screen at their appropriate locations. Test out your program by giving some of the b_#_# variables "X" and "O". You should see them appear on the screen. Once your testing is done, revert them back to empty string ""
- Define the mouseReleased() function like the example linked above. Read all of the following guidelines for mouseReleased()
- You will add/modify the mouseReleased() code block, such that you will determine where the mouse is releasing (using if-statements), and then you will change/update the corresponding b_#_# variable
- You can use the same if statements and conditionals from the previous "select-a-square" lab! (i.e. copy all your if-statements from the draw() and paste them into mouseReleased(). You will not need any of the fill() or rect() in mouseReleased()
- If a particular square is clicked, then save the current player's turn into that specific b_#_#
- Every time you release the mouse and draw "X" or "O", the turn should switch
- You must not allow a move to occur in a space that already has a move