Skip to content

Instantly share code, notes, and snippets.

@amay077
Forked from bleis-tift/zdk.fs
Last active March 16, 2016 16:32
Show Gist options
  • Save amay077/9c9489497c2fc3b08588 to your computer and use it in GitHub Desktop.
Save amay077/9c9489497c2fc3b08588 to your computer and use it in GitHub Desktop.
ズンドコキヨシ with F#
open System
type Sound = Z | D | K
with
override this.ToString() =
match this with
| Z -> "ズン"
| D -> "ドコ"
| K -> "キ・ヨ・シ!"
let rnd = Random()
let genSound () = [|Z;D|].[rnd.Next(2)]
let rec loop x = function
| D::Z::Z::Z::Z::D::_ as xs -> printfn "%s" (string K)
| xs -> printf "%s" (string x); loop (genSound ()) (x::xs)
[<EntryPoint>]
let main _ =
loop (genSound ()) []
0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment