Created
June 18, 2016 06:54
-
-
Save aiya000/0721b6d18aa5ffdd6c4cf6ae93060ca5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public class Program { | |
public static void Main(string[] args) { | |
var q = new ZuQueue(); | |
for (;;) { | |
var newFace = q.Next(); | |
Console.Write(newFace); | |
if (q.IsSucceed()) { | |
Console.WriteLine("キ・ヨ・シ!"); | |
break; | |
} | |
} | |
} | |
} | |
class ZunGenerator { | |
private static Random random = new Random(); | |
private static string[] samples = new [] { "ズン", "ドコ" }; | |
public static string Generate() { | |
return samples[random.Next(0, 2)]; | |
} | |
} | |
class ZuQueue { | |
private Tuple<string,string,string,string,string> result = Tuple.Create("", "", "", "", ""); | |
public bool IsSucceed() { | |
var _1 = this.result.Item1; | |
var _2 = this.result.Item2; | |
var _3 = this.result.Item3; | |
var _4 = this.result.Item4; | |
var _5 = this.result.Item5; | |
return _1 == "ズン" && | |
_2 == "ズン" && | |
_3 == "ズン" && | |
_4 == "ズン" && | |
_5 == "ドコ"; | |
} | |
public string Next() { | |
var _2 = this.result.Item2; | |
var _3 = this.result.Item3; | |
var _4 = this.result.Item4; | |
var _5 = this.result.Item5; | |
var newFace = ZunGenerator.Generate(); | |
this.result = Tuple.Create(_2, _3, _4, _5, newFace); | |
return newFace; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment