public void LoadAndReplay()
		{
			var dir = new DirectoryInfo(@"C:\Code\AIGames.Challenger\games\texas-hold-em");

			var bot = new ACDCBot();
			bot.Actor.Nodes.Clear();

			foreach (var file in dir.GetFiles("*.log"))
			{
				using (var platform = new ConsolePlatformTester(file))
				{
					platform.DoRun(bot);
				}
			}
			var nodes = new List<Node>(bot.Actor.Nodes);
			nodes.Sort();
			nodes.Save(new FileInfo(@"C:\temp\data.bin"));
			using (var writer = new StreamWriter(@"C:\temp\data.log"))
			{
				foreach (var node in nodes)
				{
					writer.WriteLine(node);
				}
			}
		}
		public void DoRun_Simple_NoExceptions()
		{
			using(var platform = new ConsolePlatformTester("input.simple.txt"))
			{
				platform.DoRun(new ACDCBot());
			}
		}
        public void Parse_All()
        {
            var reader = ConsolePlatformTester.LoadInput("input.simple.txt");
            var actual = Instruction.Read(reader).ToArray();

            var expected = new IInstruction[]
            {
                // Settings
                new HandsPerLevelInstruction(10),
                new StartingStackInstruction(2000),
                new YourBotInstruction(PlayerName.player1),
                new TimeBankInstruction(TimeSpan.FromSeconds(10)),
                new TimePerMoveInstruction(TimeSpan.FromMilliseconds(500)),
                // Match
                new RoundInstruction(1),
                new SmallBlindInstruction(10),
                new BigBlindInstruction(20),
                // Player
                new OnButtonInstruction(PlayerName.player2),
                new StackInstruction(PlayerName.player1, 2000),
                new StackInstruction(PlayerName.player2, 2000),
                new PostInstruction(PlayerName.player2, 10),
                new PostInstruction(PlayerName.player1, 20),
                new HandInstruction(PlayerName.player1, Cards.Parse("[9c,7h]")),
                new ActionInstruction(PlayerName.player2, GameAction.Call),
            };

            CollectionAssert.AreEqual(expected, actual.Take(expected.Length).ToArray());
            Assert.AreEqual(0, actual.Length);
        }
Beispiel #4
0
 public void DoRun_Simple_NoExceptions()
 {
     using (var platform = new ConsolePlatformTester("input.simple.txt"))
     {
         platform.DoRun(new ACDCBot());
     }
 }