diff --git a/gib-gab-gob/game.scm b/gib-gab-gob/game.scm index 231390e..d77a490 100644 --- a/gib-gab-gob/game.scm +++ b/gib-gab-gob/game.scm @@ -11,7 +11,14 @@ (define peer-mark (if initiator? 'o 'x)) (define board (make-board)) (define my-turn? (not initiator?)) - + (define (i-won?) (board-winner? board mark)) + (define (peer-won?) (board-winner? board peer-mark)) + (define (display) + (board-display board) + (format #t "-> It is ~a turn\n" (if my-turn? "my" "peer's")) + (when (i-won?) (format #t "*** I won! ***\n")) + (when (peer-won?) (format #t "*** I lost! ***\n"))) + (display) (methods ;; The peer is telling us about the turn it took. [(peer-turn! x y) @@ -19,7 +26,7 @@ (begin (board-choose! board peer-mark x y) (set! my-turn? (not my-turn?)) - (board-display board)) + (display)) (error "It's my turn!"))] ;; TODO: This needs to go somewhere else so the peer can't move for us! [(my-turn! x y) @@ -27,5 +34,5 @@ (begin (board-choose! board mark x y) (set! my-turn? (not my-turn?)) - (board-display board)) + (display)) (error "It's not my turn."))]))