lambdaize

This commit is contained in:
Vivianne 2023-07-03 01:09:24 -07:00
parent d39811d38e
commit 3ce3051bef

View file

@ -33,7 +33,7 @@
[(register-opponent name peer sealed-pick) [(register-opponent name peer sealed-pick)
(format #t "Hey there, ~a! You sent me your pick of rock-paper-scissors; now I will send mine.\n" name) (format #t "Hey there, ~a! You sent me your pick of rock-paper-scissors; now I will send mine.\n" name)
(on (<- (<- peer 'pick->unsealer pick) sealed-pick) (on (<- (<- peer 'pick->unsealer pick) sealed-pick)
(lambda (peer-pick) (λ (peer-pick)
(define won? (rps-winner pick peer-pick)) (define won? (rps-winner pick peer-pick))
(format #t "Opponent ~a has picked ~a (do I win? ~a). Time to be a controller.\n" name peer-pick won?) (format #t "Opponent ~a has picked ~a (do I win? ~a). Time to be a controller.\n" name peer-pick won?)
(bcom (^game-controller bcom won? peer))))])) (bcom (^game-controller bcom won? peer))))]))
@ -51,8 +51,7 @@
(define lobby ($ mycapn 'enliven lobby-sref)) (define lobby ($ mycapn 'enliven lobby-sref))
(define client-picker (spawn ^client-picker lobby ^game-controller)) (define client-picker (spawn ^client-picker lobby ^game-controller))
(on (<- lobby 'register-opponent user-name client-picker ($ client-picker 'get-sealed-pick)) (on (<- lobby 'register-opponent user-name client-picker ($ client-picker 'get-sealed-pick))
(lambda (_) (λ (_) (format #t "~a finished the game.\n" user-name)))))
(format #t "~a finished the game.\n" user-name)))))
(define (^client-picker bcom lobby ^game-controller) (define (^client-picker bcom lobby ^game-controller)
(define-values (seal-pick unseal-pick my-pick?) (define-values (seal-pick unseal-pick my-pick?)