Ok, it's not completely like Simon Says, since it's text-based. There is nothing about memorizing based on visual cues and/or sound here, just memorizing long sequences of numbers. I wanted to do it in the language I write the least code in, Scheme (w/ Chicken), and see what happens.
(use posix)
(use (srfi 1))
(define button-count 4)
(define (clear-screen)
(system "cls"))
(define (make-delay)
(sleep 2))
(define (show-sequence sequence)
(if (not (null? sequence))
(begin
(clear-screen)
(make-delay)
(write (car sequence))
(make-delay)
(show-sequence (cdr sequence)))
(begin
(clear-screen)
(write-line "GO!"))))
(define (show-score score)
(format #t "Your score: ~A~%" score))
(define (get-player-input)
(read-line))
(define (make-sequence length)
(map random (make-list length button-count)))
(define (player-sequence-matches? target-sequence)
(cond
[(null? target-sequence) #t]
[(string=? (get-player-input) (number->string (car target-sequence)))
(player-sequence-matches? (cdr target-sequence))]
[else #f]))
(define (simon-says difficulty)
(let [(current-sequence (make-sequence difficulty))]
(show-sequence current-sequence)
(if (player-sequence-matches? current-sequence)
(+ 1 (simon-says (+ difficulty 1)))
0)))
(define (play-simon-says)
(show-score (simon-says 1)))
If you want to run it on something Unix, you'll need to change (system "cls")
to (system "clear")
.