public static void Main() { using (var map = new WebMap()) { var solver = new MinesweeperSolver(map); var screenshot = solver.Run(); } // var map = WebMap.Load(); // var mapHandler = new MapHandler(); // var solver = new SolverEngine( // new SimpleEngine(), // new TrickEngine(mapHandler)); // while (true) // { // foreach (var step in solver.RunStep()) { } // } // //var solver = new MinesweeperSolver(new MinesweeperDriver(new ChromeDriver())); // //var result = await solver.Run(); }
//[TestProperty("MiddleSquareTestingWithoutMines", "0")] public void GetLocationValue_SquareInMiddleWithoutMines_Success() { int[,] inputBoard = new int[, ] { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { -1, 0, -1 } }; MinesweeperSolver minesweeperSolver = new MinesweeperSolver(3, 3, inputBoard); int locationValue = minesweeperSolver.GetLocationValue(1, 1); Assert.AreEqual(0, locationValue); }
//[TestProperty("CornerSquareTesting", "5")] public void GetLocationValue_SquareAllSurroundedByMines_Success() { int[,] inputBoard = new int[, ] { { -1, 0, -1 }, { -1, -1, -1 }, { 0, 0, 0 } }; MinesweeperSolver minesweeperSolver = new MinesweeperSolver(3, 3, inputBoard); int locationValue = minesweeperSolver.GetLocationValue(0, 1); Assert.AreEqual(5, locationValue); }
//[TestProperty("BottomCornerSquareTesting", "1")] public void GetLocationValue_BottomCornerSquareWithMine_Success() { int[,] inputBoard = new int[, ] { { -1, 0, 0 }, { 0, -1, 0 }, { 0, 0, 0 } }; MinesweeperSolver minesweeperSolver = new MinesweeperSolver(3, 3, inputBoard); int locationValue = minesweeperSolver.GetLocationValue(2, 2); Assert.AreEqual(1, locationValue); }
public void SolveGame_With_Success() { int[,] inputBoard = new int[, ] { { -1, -1, -1, 0, -1 } }; MinesweeperSolver minesweeperSolver = new MinesweeperSolver(3, 3, inputBoard); //int locationValue = minesweeperSolver.GetLocationValue(10, 10); Assert.Throws <IndexOutOfRangeException>(() => minesweeperSolver.GetLocationValue(10, 10)); }
//[TestProperty("WithOneRow", "")] public void SolveGame_WithOneRow_Success() { int[,] inputBoard = new int[, ] { { -1, -1, -1, 0, -1 } }; int[,] expectedOutputBoard = new int[, ] { { -1, -1, -1, 2, -1 } }; MinesweeperSolver minesweeperSolver = new MinesweeperSolver(5, 1, inputBoard); int[,] outputBoard = minesweeperSolver.SolveGame(); CollectionAssert.AreEqual(expectedOutputBoard, outputBoard); }
//[TestProperty("WithOneColumn", "")] public void SolveGame_WithOneColumn_Success() { int[,] inputBoard = new int[, ] { { -1 }, { -1 }, { -1 }, { 0 }, { -1 } }; int[,] expectedOutputBoard = new int[, ] { { -1 }, { -1 }, { -1 }, { 2 }, { -1 } }; MinesweeperSolver minesweeperSolver = new MinesweeperSolver(1, 5, inputBoard); int[,] outputBoard = minesweeperSolver.SolveGame(); CollectionAssert.AreEqual(expectedOutputBoard, outputBoard); }
//[TestProperty("SolveBoardWithEmptyMines", "All Zeors")] public void SolveGame_WithEmptyMines_Success() { int[,] inputBoard = new int[, ] { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }; int[,] expectedOutputBoard = new int[, ] { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }; MinesweeperSolver minesweeperSolver = new MinesweeperSolver(3, 3, inputBoard); int[,] outputBoard = minesweeperSolver.SolveGame(); CollectionAssert.AreEqual(expectedOutputBoard, outputBoard); }