public static void PrintCapturedPieces(ChessGame game) { Console.WriteLine("Captured pieces: "); Console.Write("White: "); Console.ForegroundColor = ConsoleColor.Cyan; PrintSet(game.CapturedPieces(Color.White)); Console.ForegroundColor = ConsoleColor.White; Console.Write("Black: "); Console.ForegroundColor = ConsoleColor.Yellow; PrintSet(game.CapturedPieces(Color.Black)); Console.ForegroundColor = ConsoleColor.White; }
public static void PrintCapturedPieces(ChessGame chessGame) { Console.WriteLine("Captured Pieces"); Console.Write("White: "); PrintGroup(chessGame.CapturedPieces(Color.White)); Console.WriteLine(); Console.Write("Black: "); ConsoleColor aux = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Yellow; PrintGroup(chessGame.CapturedPieces(Color.Black)); Console.ForegroundColor = aux; Console.WriteLine(); }
static void Main(string[] args) { Console.CursorVisible = false; ConsoleGraphics graphics = new ConsoleGraphics(); game = new ChessGame(); do { game.Draw(graphics); graphics.SwapBuffers(); game.Update(); } while (game.Running); Console.Read(); }
public static void ImprimirPecasCapturadas(ChessGame Game) { Console.WriteLine("Peças capturadas:"); Console.Write("Brancas: "); ConsoleColor aux = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.White; imprimirConjunto(Game.PieceCaptured(Color.White)); Console.ForegroundColor = aux; Console.WriteLine(); Console.Write("Pretas: "); ConsoleColor aux2 = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; imprimirConjunto(Game.PieceCaptured(Color.Black)); Console.ForegroundColor = aux2; Console.WriteLine(); }
static void Main(string[] args) { try { ChessGame chessGame = new ChessGame(); while (!chessGame.Terminated) { try { Console.Clear(); Screen.PrintChessGame(chessGame); Console.Write("Origin: "); Position origin = Screen.ReadChessPosition().ToPosition(); chessGame.ValidatePositionOrigin(origin); bool[,] posiblePositions = chessGame.BoardGame.Piece(origin).PossibleMoves(); Console.Clear(); Screen.PrintBoardGame(chessGame.BoardGame, posiblePositions); Console.WriteLine(); Console.Write("Destiny: "); Position destiny = Screen.ReadChessPosition().ToPosition(); chessGame.ValidatePositionDestiny(origin, destiny); chessGame.MakeMove(origin, destiny); } catch (BoardException e) { Console.WriteLine(e.Message); Console.ReadLine(); } } Console.Clear(); Screen.PrintChessGame(chessGame); } catch (BoardException e) { Console.WriteLine(e.Message); } Console.ReadLine(); }
public static void PrintGame(ChessGame game) { PrintBoard(game.board); PrintCapturedPieces(game); Console.WriteLine(); Console.WriteLine("Turn: " + game.turn); if (!game.finished) { Console.WriteLine("Waiting move: " + game.actualPlayer); if (game.Check) { Console.WriteLine("CHECK!!"); } } else { Console.WriteLine("CHECKMATE!!"); Console.WriteLine(game.actualPlayer + " WINS!"); } }
static void Main(string[] args) { try { ChessGame Game = new ChessGame(); while (!Game.Finish) { Console.Clear(); Screen.ImprimirPartida(Game); Console.WriteLine(); Console.WriteLine("PRIMEIRO LETRA DEOPIS NUMERO EX: a1"); Console.WriteLine(); Console.Write("Origin: "); Posicao origin = Screen.ReadPositionChess().ToPosition(); bool[,] PossiblePosition = Game.Chess.Piece(origin).PossibleMovments(); Console.Clear(); Screen.ImprimirTabuleiro(Game.Chess, PossiblePosition); Console.WriteLine(); Console.Write("Destino: "); Posicao destiny = Screen.ReadPositionChess().ToPosition(); Game.ValidatePositionDestiny(origin, destiny); Game.MakePlay(origin, destiny); } } catch (ChessBoardException ce) { Console.WriteLine(ce.Message); } Console.ReadLine(); }
public static void PrintChessGame(ChessGame chessGame) { PrintBoardGame(chessGame.BoardGame); Console.WriteLine(); PrintCapturedPieces(chessGame); Console.WriteLine(); Console.WriteLine("Turn: " + chessGame.Turn); if (!chessGame.Terminated) { Console.WriteLine("Waiting for the move: " + chessGame.ActualPlayer); if (chessGame.Check) { Console.WriteLine("Check!"); } } else { Console.WriteLine("Checkmate!!"); Console.WriteLine("Winner: " + chessGame.ActualPlayer); } }
static void Main(string[] args) { ChessGame game = new ChessGame(); while (!game.finished) { try { Console.Clear(); Screen.PrintGame(game); Console.WriteLine(); Console.Write("Origin: "); Position orig = Screen.ReadChessPos().ToPosition(); game.ValidOrigPos(orig); bool[,] possiblePositons = game.board.GetPiece(orig).AvailableMovs(); Console.Clear(); Screen.PrintBoard(game.board, possiblePositons); Console.Write("Destination: "); Position dest = Screen.ReadChessPos().ToPosition(); game.ValidDestPos(orig, dest); game.DoPlay(orig, dest); } catch (BoardException e) { Console.WriteLine(e.Message); Console.ReadLine(); } Console.Clear(); Screen.PrintGame(game); } }
public static void ImprimirPartida(ChessGame Game) { ImprimirTabuleiro(Game.Chess); Console.WriteLine(); ImprimirPecasCapturadas(Game); ConsoleColor aux = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Turno: " + Game.Turno); Console.ForegroundColor = aux; if (!Game.Finish) { Console.WriteLine("Aguardando jogada : " + Game.PlayerAct); if (Game.Check) { Console.WriteLine("XEQUE MANO"); } } else { Console.WriteLine("XEQUE MATE BROW"); Console.WriteLine("VENCEDOR: " + Game.PlayerAct); } }