https://www.youtube.com/watch?v=SRzSZ_rEE_A
https://www.youtube.com/watch?v=OLGVhszBlq4
https://www.youtube.com/watch?v=gI-qXk7XojA
https://www.youtube.com/watch?v=rL8X2mlNHPM&list=PL8dPuuaLjXtNlUrzyH5r6jN9ulIgZBpdo&index=14 algorithms sorting
https://apcentral.collegeboard.org/courses/ap-computer-science-principles/course
For loop https://docs.google.com/presentation/d/14mZIEtEolktPf1ByOYKt5OgwmNq3PBmzzEa2w5QYCEY/edit#slide=id.g136a8780e3_0_4
Operators
https://docs.google.com/document/d/1MLE4n4tXoV3yjFl9EoD9S4mNOIUUYBqLQcR5huA_oOk/edit
https://apcentral.collegeboard.org/courses/resources/about-ap-digital-portfolio
For example, on the Unit 2 Lab 1 page, Developing a Number Guessing Game with Script Variables , you may choose to explore the concept of a binary search algorithm and to develop an algorithm offline before even opening Snap!. Some teachers have used this approach:
In both of the in-person Number Guessing Game and the Guess My Word games, be animated about the halving process after each clue.
- First, play a round or two of the Number Guessing Game in small groups or as a class.
- Then, play a round of 'Guess My Word.' One person selects a (perhaps random) word from a dictionary, and the other person tries to find that word in the dictionary by selecting a word about halfway through the possibilities left and asking if the chosen word is before or after.
- Then, have a class discussion:Then introduce the idea of writing out an algorithm in regular words (e.g. "prompt the user to pick a number within the range"). Provide chart paper to each group if available.
- How were we making our guesses?
- What did we do with the information received (such as "no, the number I'm thinking of is lower", or "no, my word comes after that")?
Emphasize how the previous guess becomes the new upper bound or lower bound for the new range of possibilities.
- Encourage students to record the bounds of the range and the number guessed on paper in a new row of a table to help keep track of their algorithm-testing process and to communicate their progress with their group-mates.
- Now ask students to write instructions for the computer. Their syntax will likely mimic the programming language(s) with which they are most familiar (e.g. Snap!), but they should not be held to this as a constraint.
- As the very last step, they can code the algorithm in Snap!. If all goes well, the time spent programming in Snap! will be significantly less than the time spent building the algorithm offline as the majority of the debugging will already have been done on paper.
http://snap.berkeley.edu/snapsource/snap.html#present:Username=bjcsolutions&ProjectName=U2L1-ClickAlonzowithScore%20(answer%20file)
Let’s say I am picking a random number between 1 and 1,000,000
224,031 works
Given only the hints of higher or lower I would begin guessing at
500,000?
lower
You have just eliminated half of the options. There were 1,000,000 options but now there are only 500,000 options after 1 guess. This slicing continues:
250,000?
lower
125,000?
higher
middle of 125,000 and 250,000 is the lower boundary (125,000) + half the distance between the two numbers (62,500)
sooooo 187,500?
higher
Note that regardless of answer the next amount leaves only 31250 options. This is down from 1,000,000 to 31,250, a difference of 968,750. 96.875% bad options eliminated in 4 guesses.
218750?
not 224,031 yet … higher
( (upperbound) 250,000 - (lower bound) 224,031 )/ 2 = 12984.5 difference of numbers cut in half
224,031 (lower bound) + 12984.5 (half difference) = 237015.5
lets round for convenience to 237016
237016?
lower
217538?
higher
227277? in 8 guesses we only have 9739 options left
Well I kept doing this by hand but recognized… I got into coding to make the algorithms do the work for me so I made the following:
Link to number guessing javascript
Now… let me instead copy paste in the results that gets spit out of my script (I love being constructively lazy):
The target number is 481025
Guess #1: 500000?
lower
Guess #2: 250000?
higher
Guess #3: 375000?
higher
Guess #4: 437500?
higher
Guess #5: 468750?
higher
Guess #6: 484375?
lower
Guess #7: 476562?
higher
Guess #8: 480468?
higher
Guess #9: 482421?
lower
Guess #10: 481444?
lower
Guess #11: 480956?
higher
Guess #12: 481200?
lower
Guess #13: 481078?
lower
Guess #14: 481017?
higher
Guess #15: 481047?
lower
Guess #16: 481032?
lower
Guess #17: 481024?
higher
Guess #18: 481028?
lower
Guess #19: 481026?
lower
Guess #20: 481025?
Yes! the secret number was 481025
the answer was found in 20 guesses!
=> ‘EUREKA!!!’
the maximum amount of times it needs to guess is 20. By cutting the number of options in half each step you see the following:
500000 options left after 1 guesses
250000 options left after 2 guesses
125000 options left after 3 guesses
62500 options left after 4 guesses
31250 options left after 5 guesses
15625 options left after 6 guesses
7812 options left after 7 guesses
3906 options left after 8 guesses
1953 options left after 9 guesses
976 options left after 10 guesses
488 options left after 11 guesses
244 options left after 12 guesses
122 options left after 13 guesses
61 options left after 14 guesses
30 options left after 15 guesses
15 options left after 16 guesses
7 options left after 17 guesses
3 options left after 18 guesses
1 options left after 19 guesses
20th answer is the winner in the longest possible path to a solution
Another visualization of it is from the following site:
blog.penjee.com2
Boolean Logic5
More Boolean Logic4
Also, here’s a Google Doodle for G.B.: Birthday Boole4
https://wiki.scratch.mit.edu/wiki/Truth_Table
A good bit-by-bit overview video series: https://www.youtube.com/watch?v=vR-y_2zWrIE&index=1&list=PLWKjhJtqVAbkFiqHnNaxpOPhh9tSWMXIF1
Little dryer, but the first video does start from the very beginning and has a bit more of the ‘why’: https://www.youtube.com/watch?v=8oRjP8yj2Wo&list=PLg7s6cbtAD165JTRsXh8ofwRw0PqUnkVH
http://cestlaz.github.io/posts/programming-idioms/#.WiQTL5OGNmB
http://www.101computing.net/guess-who/
WarmUpWorksheet-solution.docx11 (877.4 KB)
WarmUpWorksheet.docx15 (868.9 KB)
https://sites.google.com/site/mattdorowsmobilecsp/reflections/coin-flip-simulation
https://www.exploreapcsp.com/u2l3-part2
http://pblchecklist.4teachers.org/testing.php?idunique=3&max=6&checklist=9
CompArt 20Slideshow(LoopsConditional)