ズンドコキヨシ with Wren

  • 0
    Like
  • 0
    Comment
    More than 1 year has passed since last update.

    参考: http://qiita.com/y__sama/items/7c451dfd706f9b36729d

    import "random" for Random
    var z = "ズン"
    var d = "ドコ"
    var zd = [z, d]
    var expected = [z, z, z, z, d].join()
    var random = Random.new()
    var tmp = []
    (0..4).each {tmp.add(random.sample(zd))}
    var actual = tmp.join()
    System.print(actual)
    while(actual != expected) {
        tmp.removeAt(0)
        var x = random.sample(zd)
        System.print(x)
        tmp.add(x)
        actual = tmp.join()
    }
    System.print("キ・ヨ・シ!")
    

    Playground

    スクリーンショット_031216_012204_AM.jpg

    外部サイト