Created
December 7, 2023 12:47
-
-
Save elderica/6f9ccd7ab1b6b1ed9baba431c872a493 to your computer and use it in GitHub Desktop.
ズンドコ問題
This file contains hidden or 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
#lang racket | |
(define (take-upto length lst) | |
(cond | |
[(<= length 0) null] | |
[(null? lst) null] | |
[else (cons (first lst) | |
(take-upto (sub1 length) (rest lst)))])) | |
(define (zundoko) | |
(define (rec history) | |
(if (equal? history (list 1 0 0 0 0)) ; ドコ ズン ズン ズン ズン | |
(displayln "キ・ヨ・シ!") | |
(let ([i (random 2)]) | |
(display (vector-ref (vector "ズン" "ドコ") i)) | |
(rec (take-upto 5 (cons i history)))))) | |
(rec null)) | |
(zundoko) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment