public void GetThreatsFindsSimpleHorizontalThreat() { Grid_Accessor grid = new Grid_Accessor(new PrivateObject(new Grid(7, 6, 0))); grid.Move(1, 0); grid.Move(1, 1); grid.Move(2, 0); grid.Move(2, 1); grid.Move(3, 0); grid.Move(3, 1); ValidateThreats(grid, 0); ValidateThreats(grid, 1); }
public void GetThreatsFuzzTest() { Random random = new Random(0); const int gameLimit = 200; for (int game = 1; game < gameLimit; game++) { Grid_Accessor grid = new Grid_Accessor(new PrivateObject(new Grid(7, 6, 0))); // Play a full random, game, and verify threats after each move. for (int i = 0; i < 7 * 6 && grid.IsGameOver() == -1; i++) { ValidateThreats(grid, 0); ValidateThreats(grid, 1); int move; do { move = random.Next(grid.Width); } while (!grid.IsValidMove(move)); int player = i & 1; grid.Move(move, player); } } }
public void GetThreatsIgnoresBlockedHorizontalThreats() { Grid_Accessor grid = new Grid_Accessor(new PrivateObject(new Grid(7, 6, 0))); grid.Move(1, 0); grid.Move(1, 1); grid.Move(2, 0); grid.Move(2, 1); grid.Move(3, 0); grid.Move(3, 1); grid.Move(6, 0); grid.Move(0, 1); grid.Move(0, 0); ValidateThreats(grid, 0); ValidateThreats(grid, 1); }
public void GetThreatsIgnoresBlockedByEdge() { Grid_Accessor grid = new Grid_Accessor(new PrivateObject(new Grid(7, 6, 0))); grid.Move(6, 0); grid.Move(6, 1); grid.Move(5, 0); grid.Move(5, 1); grid.Move(4, 0); grid.Move(4, 1); ValidateThreats(grid, 0); ValidateThreats(grid, 1); }