Skip to content

Instantly share code, notes, and snippets.

@elderica
Last active November 30, 2023 10:41
Show Gist options
  • Save elderica/44bf02aaad98e75d0a4afbc120d787cc to your computer and use it in GitHub Desktop.
Save elderica/44bf02aaad98e75d0a4afbc120d787cc to your computer and use it in GitHub Desktop.
ドドスコ問題
#lang racket
(define ds (vector "ドド" "スコ"))
(define (take-upto lst pos)
(cond
[(<= pos 0) null]
[(null? lst) null]
[else (cons (car lst)
(take-upto (cdr lst) (sub1 pos)))]))
(define (take-history history)
(take-upto history 12))
(define (ddsk-rec history)
(if (equal? (take-history history)
(list 1 1 1 0 1 1 1 0 1 1 1 0))
(displayln "ラブ注入♡")
(let ([i (random 2)])
(display (vector-ref ds i))
(ddsk-rec (cons i history)))))
(ddsk-rec null)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment