private bool WouldCheck(PieceMove moveVector) { Board testBoard = Clone() as Board; testBoard.Move(moveVector); return(testBoard.FindChecks(this[moveVector.vector.p1].GetColour()).Count() > 0); }
public void Begin(PlayerType white, PlayerType black) { playerQueue = new PlayerQueue(Player.MakePlayer(white, true, renderer, mouse), Player.MakePlayer(black, false, renderer, mouse)); board = new Board(template); renderer.SetSource(board); renderer.RenderIcons(); Player player = playerQueue.PeekPlayer(); while (board.GetMoves(player.GetColour()).Length > 0) { board.Move(player.Move(board)); renderer.ResetHighlights(renderHandle); player = playerQueue.Next(); if (board.FindChecks(player.GetColour()).Count() > 0) { renderer.SetHighlight(renderHandle, Highlight.InCheck, board.FindKing(player.GetColour())); } renderer.RenderIcons(); } Console.WriteLine("{0} player won", player.GetColour() ? "black" : "white"); }