public void DoMoveAndDisplay(IMove move) { Console.WriteLine(move); Console.WriteLine("#############"); if (Turn < 25 || move.ActionType == ActionType.Pass) { Do(move); GridConsole.DisplayCube(Cube); Console.WriteLine("End Display"); Console.ReadLine(); } else { ++Turn; var mv = move as MoveBattle; int nb = mv.AllSteps.Count, k = 0; foreach (var ms in mv.AllSteps) { ms.DoStep(Cube, mv.Player); GridConsole.DisplayCube(Cube); Console.WriteLine($"frame: {++k}/{nb}"); if (k != nb) { Console.ReadLine(); } } Console.WriteLine("End Display"); Console.ReadLine(); Player = move.Player.GetOpponent(); } }
public static void DisplayMoves(Cube cube, SortedSet <MoveBattle> moves) { Console.WriteLine($"Nb Moves:{moves.Count}"); Console.ReadLine(); var export0 = cube.ExportState(); foreach (var mv in moves) { GridConsole.DisplayCube(cube); Console.WriteLine(mv); Console.WriteLine("#############"); Console.ReadLine(); foreach (var ms in mv.AllSteps) { ms.DoStep(cube, mv.Player); GridConsole.DisplayCube(cube); Console.ReadLine(); } mv.Undo(cube); var export1 = cube.ExportState(); if (!export0.Equals(export1)) { throw new Exception(); } } }
public static void Main(string[] args) { //DisplayDemo.Moves1(); //Benchmark.BruteForce(6); var g = new GameState(MoveStrategy.Domination); g.Cube.ImportState("112001122011101101000001"); g.Turn = 39; g.Player = Content.P1; while (!g.EndGame()) { int depth = g.Turn < 25 ? 3 : 6; GridConsole.DisplayCube(g.Cube); Console.WriteLine("Compute...."); var mv = MinMaxAlgorithm.AlphaBeta(g, depth); g.DoMoveAndDisplay(mv); } }