diff --git a/gib-gab-gob/game.scm b/gib-gab-gob/game.scm index ce6b623..fc7fcaa 100644 --- a/gib-gab-gob/game.scm +++ b/gib-gab-gob/game.scm @@ -20,7 +20,9 @@ ((board-winner? board peer-mark) 'lost) (else 'play))) (define (signal-turn) + (format #t "signal-turn start\n") (syscaller-free-fiber (λ () (put-message state+ (%state)))) + (format #t "signal-turn end\n") #f) (define (switch-turn!) (let ((new-turn (not ($ %my-turn?)))) @@ -34,7 +36,8 @@ (if (not ($ %my-turn?)) (begin (board-choose! board peer-mark x y) - (switch-turn!)) + (switch-turn!) + (format #t "I, the peer, finish my turn.\n")) (error "It's my turn!"))] ;; TODO: These need to go somewhere else so the peer can't move or init for us! [(try-transition) 'playing] @@ -47,11 +50,14 @@ (format #t "Peer's status: ~a\n" status) status) #:promise? #t)] [(my-turn! x y) + (format #t "start my-turn!\n") (if ($ %my-turn?) (begin (board-assert-vacant board x y) + (format #t "tell peer about it\n") (on (<- peer 'peer-turn! x y) (λ (_) + (format #t "peer promise resolve, then switch and return\n") (board-choose! board mark x y) (switch-turn!) (%state)) diff --git a/gib-gab-gob/ui/console.scm b/gib-gab-gob/ui/console.scm index e4fd85b..5ce8b2b 100644 --- a/gib-gab-gob/ui/console.scm +++ b/gib-gab-gob/ui/console.scm @@ -31,13 +31,14 @@ #f)) (define (%read) - (define line (read-line (current-input-port))) - (if (string-prefix? ",q" line) #f - (let ((coords (map string->number (string-tokenize line char-set:digit)))) - (if (not (= (length coords) 2)) - (begin (format #t "Must be two numbers, x y; or ,quit to quit. Try again.\n") - (%prompt) (%read)) - coords)))) + (%prompt) + (let ((line (read-line (current-input-port)))) + (if (string-prefix? ",q" line) #f + (let ((coords (map string->number (string-tokenize line char-set:digit)))) + (if (not (= (length coords) 2)) + (begin (format #t "Must be two numbers, x y; or ,quit to quit. Try again.\n") + (%prompt) (%read)) + coords))))) (define (%eval vat b controller coordinates) ;; weird? @@ -47,8 +48,7 @@ (λ (state) (%display b state))))) (define (%print b state) - (%display b state) - (%prompt)) + (%display b state)) (define (%prompt) (format #t "Enter your move: "))