Last active
August 29, 2015 14:08
-
-
Save yuu-nkjm/cfcd013dc16d82d8dbdf to your computer and use it in GitHub Desktop.
ultimatum-game
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (def:game-scenario) | |
(def:rounds 10 | |
(def:stage 'ultimatum | |
(def:task 'P 'issue-ultimatum)) | |
(def:task 'R 'vote-yes-or-no) | |
(def:task 'divide-money))) | |
(define (issue-ultimatum ctx self) | |
(ui:request-input self:name | |
(ui:form "Rにいくらを分け与えますか?" | |
(ui:val-input 'proposition)) | |
(lambda (input) | |
(self:set 'proposition input) | |
(send-message 'R (cons 'proposition input))))) | |
(define (vote-yes-or-no ctx self) | |
(define msg (self:msgbox:pop)) | |
(ui:request-input self:name | |
(ui:form (to-string "Pさんは,あなたに" | |
(msg:get 'proposition) "円を打診しました.") | |
(ui:radio-input "受けとる?" 'y-or-n "y" | |
(list "y" "n") (list "y" "n"))) | |
(lambda (y-n) | |
(self:set 'y-or-n y-n)))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment