public void Test960Castling() { AtomicChessGame game = new AtomicChessGame("rqknrnbb/pppppppp/8/8/8/8/PPPPPPPP/RQKNRNBB w KQkq - 0 1"); string[] moves = { "g2g3", "d8c6", "h2h3", "f8e6", "f2f3", "f7f6", "a2a3", "g8f7", "b2b3", "g7g6", "c2c3", "h8g7", "e2e3", "b7b6", "d2d3", "b8b7", "c3c4" }; foreach (string m in moves) { game.ApplyMove(new Move(m.Substring(0, 2), m.Substring(2, 2), game.WhoseTurn), true); } Assert.True(game.IsValidMove(new Move("C8", "E8", Player.Black))); Assert.True(game.IsValidMove(new Move("C8", "A8", Player.Black))); }
public void Test960Castling2() { AtomicChessGame game = new AtomicChessGame("bnrbkrnq/pppppppp/8/8/8/8/PPPPPPPP/BNRBKRNQ w KQkq - 0 1"); string[] moves = { "b2b3", "h7h6", "a1b2", "g7g6", "b1a3", "e7e6", "c2c3", "d7d6", "d1c2", "c7c6", "g1f3", "b7b6", "h2h3", "a7a6", "h1h2", "f7f6" }; foreach (string m in moves) { game.ApplyMove(new Move(m.Substring(0, 2), m.Substring(2, 2), game.WhoseTurn), true); } Assert.True(game.IsValidMove(new Move("E1", "C1", Player.White))); Assert.True(game.IsValidMove(new Move("E1", "F1", Player.White))); }
public static void ValidateThatEmptyCannotMove() { AtomicChessGame game = new AtomicChessGame(); var move = new Move("c3", "c4", Player.White); var valid = game.IsValidMove(move); Assert.IsFalse(valid); }
public void TestExplosionWhenInCheck() { Piece[][] board = new Piece[8][] { new[] { o, o, o, o, o, o, kb, o }, new[] { o, o, o, o, o, o, pb, o }, new[] { o, o, o, o, o, o, o, o }, new[] { o, o, o, o, o, o, o, o }, new[] { o, o, o, o, o, o, qw, o }, new[] { o, o, o, o, o, o, o, o }, new[] { o, o, o, o, o, o, o, o }, new[] { rb, o, o, o, kw, o, o, o } }; AtomicChessGame game = new AtomicChessGame(board, Player.White); Assert.True(game.IsValidMove(new Move("G4", "G7", Player.White))); }
public void TestValidMoveAdjacentKings() { Piece[][] board = new Piece[8][] { new[] { o, o, o, o, o, o, o, o }, new[] { pw, pw, o, o, o, o, o, o }, new[] { o, o, o, o, o, o, o, o }, new[] { o, o, o, o, o, o, o, o }, new[] { o, o, o, o, o, o, o, o }, new[] { o, o, o, o, o, o, o, o }, new[] { o, o, o, o, o, o, o, o }, new[] { o, o, o, o, o, kb, o, kw } }; AtomicChessGame game = new AtomicChessGame(board, Player.Black); Assert.True(game.IsValidMove(new Move("F1", "G1", Player.Black))); }