Computer removes one coin from pile 1 unless it is empty, in which case the computer removes one coin from pile 2.The computer must return the new game state that results.
(define computer-move (lambda (game-state) (let ((pile (if (> (size-of-pile game-state 1) 0) 1 2))) (display "I take 1 coin from pile ") (display pile) (newline) (remove-coins-from-pile game-state 1 pile))))Testing computer-move:
(display-game-state (computer-move (make-game-state 5 8))) I take 1 coin from pile 1 Pile 1: 4 Pile 2: 8