2010-11-29-CS10-L25-..


CS10
The Beauty and Joy of Computing
  For every position
Lecture #25 : Tree Recursion
  Assuming alternating play
W
  Value …
2010-11-29
UC Berkeley EECS
Lecturer SOE
Dan Garcia
Review: What’s in a Strong Solution
(for player whose turn it is)
Winning (∃ losing child)
Losing (All children winning)
Tieing (!∃ losing child, but ∃
tieing child)
Drawing (can’t force a win or
be forced to lose)
MS KINECT = BODY I/O
..."
WWW
  How long before game ends?
..."
L
WWW
T
D
..."
  Remoteness
The newly released (and muchhyped) Microsoft Kinect system
for the XBOX 360 used controllerfree body motions to control
games, music, and movies.
L
WWW
..."
T
WWW
W
UC Berkeley CS10 “The Beauty and Joy of Computing” : Tree Recursion (2)
Review : Example: 1,2,…,10
Let’s write code to determine value!
  Rules (on your turn):
  Running total = 0
  0 = Win
  P = Position
  1 = Lose
  M = Move
  2 = Win
  Rules (on your turn):
  Add 1 or 2 to running total
  We only need 3 blocks to define a
  3 = Win
  Goal
game
  4 = Lose
  Be the FIRST to get to 10
  Do Move M on Position P
  5 = Win
  Example
   a new Position
  Ana: “2 to make it 2”
  6 = Win
  Bob: “1 to make it 3”
  7 = Lose
  Ana: “2 to make it 5”
  8 = Win
  Primitive Value of Position P
  9 = Win
   {win, lose, tie, undecided}
7 ducks (out of 10)
  Ana: “1 to make it 8”
  Generate Moves from Position P
   list of Moves
  10 = Lose
  Bob: “2 to make it 10” I WIN!
Garcia, Fall 2010
UC Berkeley CS10 “The Beauty and Joy of Computing” : Tree Recursion (3)
D
Garcia, Fall 2010
xbox.com/kinect/
  Bob: “2 to make it 7”  photo
W
Garcia, Fall 2010
UC Berkeley CS10 “The Beauty and Joy of Computing” : Tree Recursion (4)