1. Qiita
  2. Items
  3. anko

ズンドコキヨシ with Anko

  • 2
    Like
  • 0
    Comment

http://qiita.com/shunsugai@github/items/971a15461de29563bf90

golang で書かれたお手製のスクリプト言語 anko でズンドコキヨシやってみました。

zundoko.ank
#!anko
var rand, time = import("math/rand"), import("time")

rand.Seed(time.Now().UnixNano())

zundoko = ["ズン", "ドコ"]
arr = []
for {
  s = zundoko[rand.Int()%2]
  println(s)
  arr = arr + [s]
  if len(arr) > 5 {
    arr = arr[1:len(arr)]
  }
  if arr == ["ズン", "ズン", "ズン", "ズン", "ドコ"] {
    println("キヨシ!")
    break
  }
}

http://play-anko.appspot.com/p/8d9af627c19df577053e55c6f10fe062c52a03dc

https://github.com/mattn/anko
http://mattn.kaoriya.net/software/anko/20140328210749.htm

Comments Loading...