Other Changes Required for Three-Pile Nim

Q: Besides the constructor and selector, what other procedures need to be modified?

The Chocolate Bar Game and Two-Pile Nim Are Equivalent

Q: The length and width of the chocolate bar are equivalent to what?

If b does not divide evenly into m, then (exponent-of-in b m) should return 0.

Q: What should be returned otherwise?

      (define divides?
        (lambda (b n)
          (= 0 (remainder n b))))

      (define exponent-of-in
        (lambda (b n)
          (if (not (divides? b n))
             0
             _______ ??? _______)))
      
Constructor:
     (define make-game-state
       (lambda (i j) (+ (* 10 i) j)))

Selector:
     (define size-of-pile
       (lambda (game-state pile-number)
         (if (= pile-number 1)
             (quotient game-state 10)
             (remainder game-state 10))))

Q: What is the order of growth of size-of-pile?

Q: What is the largest pile size for which this representation will work?
   (remove-coins-from-pile game-state n p) ; given a state, returns a new
                                           ; state with n fewer coins in pile p
      
Q: (remove-coins-from-pile (make-game-state 9 6) 4 1)=???
Suppose all the procedures were written and we tried to evaluate:
	  (play-with-turns (make-game-state 5 8) 'humman)
      
Q: What would happen?
Example initial call:
     (play-with-turns (make-game-state 5 8) 'human)
      
Q: Why the single quote? What would happen if we did just:
     (play-with-turns (make-game-state 5 8) human)   ?
      
When a programmer strictly enforces the separation of how data is used from how it is represented in programs, he or she is said to be using an Abstract Data Type (ADT).

Advantages: