LoginSignup
2
1

More than 5 years have passed since last update.

待ち切れずにDartでズンドコキヨシやったった

Last updated at Posted at 2016-03-22

CoffeeScript や TypeScript があるから、
誰かが作ってくれるだろうといつまでも待っているのに・・・
誰も作ってくれないから、ズンドコDartでキヨシってみる。

zundoko.dart
#!/usr/local/bin/dart

import "dart:math";
import "dart:io";

main() {
    String zzzzdoko = "ズンズンズンズンドコ";
    List<String> target = new List<String>();
    Random ran = new Random(new DateTime.now().microsecondsSinceEpoch);

    while(zzzzdoko != target.join()) {
        sleep(new Duration(seconds:1));
        target.add("${["ズン","ドコ"][ran.nextInt(2)]}");
        if (target.length > 5) target.removeAt(0);

        print("${target[target.length - 1]}");
    }   
    print("キ・ヨ・シ!");
}

Dartもっと流行ってくれればいいのになぁ
楽しいのにぃ

DartPadに打ち込んでみた。
どうもDartのバージョンが古いのと、dart:ioライブラリをサポートしてくれていないらしいのとで、
少しだけ改変しておいた。
https://dartpad.dartlang.org/403357f5cd50a1ea8f09

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1