1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ズンドコキヨシ with Nemerle

Last updated at Posted at 2016-03-13

Nemerleでやってみた(´・ω・`) (GetZunで1秒間のウェイトを入れてます.嫌ならば,Thread.Sleep(1000)を消して,Randomクラスのコンストラクタに,毎回値が異なるシード値を入れてやればいいでしょう(´・ω・`))

zundoko
using System;
using System.Threading;
using System.Console;
using Nemerle.Collections;
using Nemerle.Text;
using Nemerle.Utility;

GetZun(randMaker : Random) : string {
        Thread.Sleep(1000);
        def s = if(randMaker.Next(2) == 0 ) "ズン" else "ドコ";
        Write(s + " ");
        s;
}

Main() : void
{
   def randMaker = Ramdom()
   def MainLoop(_) {
      | ["ズン","ズン","ズン","ズン","ドコ"] => true
      | _::xs when xs.Length > 3  => MainLoop(xs + [GetZun(randMaker)])
      | x::xs => MainLoop((x :: xs) + [GetZun(randMaker)])
   }
   _ = MainLoop([GetZun(randMaker)]);
   WriteLine("キ・ヨ・シ!");
}
1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?