public unsafe void TestIqCash() { TikTacToe tikTacToe = TikTacToe.GetClear(); RelatingIq <TikTacToe, int, int> iq = new RelatingIq <TikTacToe, int, int>(10, true, true); var result = iq.Run(tikTacToe); var resultState = result.Item2; Show(resultState); }
internal static unsafe void Show(TikTacToe t) { string z = ""; for (int i = 0; i < 9; i++) { if (i % 3 == 0) { z += Environment.NewLine; } z += t.Table[i]; } System.Diagnostics.Debug.WriteLine(z); }
public unsafe void Move() { TikTacToe tikTacToe = TikTacToe.GetClear(); tikTacToe.Table[6] = 1; tikTacToe.Table[8] = 1; tikTacToe.Table[4] = 2; tikTacToe.PlayerIndex = 1; var resultState = tikTacToe.GetStates().First(); IqTestcs.Show(resultState.Item2); Assert.AreEqual(0, resultState.Item1); Assert.AreEqual(1, resultState.Item2.Table[0]); Assert.AreEqual(2, resultState.Item2.PlayerIndex); }
public unsafe void TestIqDown() { TikTacToe tikTacToe = TikTacToe.GetClear(); tikTacToe.Table[6] = 1; tikTacToe.Table[8] = 1; tikTacToe.Table[4] = 2; tikTacToe.PlayerIndex = 2; RelatingIq <TikTacToe, int, int> iq = new RelatingIq <TikTacToe, int, int>(10, true); var result = iq.Run(tikTacToe); var resultState = result.Item2; Show(resultState); Assert.AreEqual(7, result.Item1); Assert.AreEqual(2, resultState.Table[7]); }
public unsafe void TacToWin() { TikTacToe tikTacToe = TikTacToe.GetClear(); tikTacToe.Table[0] = 1; tikTacToe.Table[1] = 1; tikTacToe.Table[2] = 1; Assert.AreEqual(tikTacToe.Winer(), 1); tikTacToe = TikTacToe.GetClear(); tikTacToe.Table[0] = 2; tikTacToe.Table[4] = 2; tikTacToe.Table[8] = 2; Assert.AreEqual(tikTacToe.Winer(), 2); tikTacToe = TikTacToe.GetClear(); tikTacToe.Table[0] = 2; tikTacToe.Table[4] = 2; tikTacToe.Table[2] = 2; Assert.AreEqual(tikTacToe.Winer(), 0); }