public static string ToLongAlgebraic(MoveDesc move, string language) { Debug.Assert(move != null && move.Piece != Pieces.NoPiece); // TODO - use language somehow // TODO - en passant? // TODO - promotions if (move.IsShortCastle) { return SHORT_CASTLE; } if (move.IsLongCastle) { return LONG_CASTLE; } // TODO - checkmate, check var s = new StringBuilder(10); s.Append(GetPieceString(move.Piece, language)); s.Append(move.From); s.Append(move.IsCapture ? ':' : '-'); s.Append(move.To); if (move.IsCheckmate) { s.Append(CHAR_CHECKMATE); } else if (move.IsCheck) { s.Append(CHAR_CHECK); } return s.ToString(); }
public CommandPlayMove(MoveDesc move) { if (move == null) { throw new ArgumentNullException(); } m_move = move; }
public void PlayMove(MoveDesc move) { // TODO - check a lot of conditions here m_analyzer.PlayMove(move); }
public bool IsSame(MoveDesc other) { // TODO return Piece == other.Piece && From.IsSame(other.From) && To.IsSame(other.To) && PromoteTo == other.PromoteTo && IsPromotion == other.IsPromotion && IsCapture == other.IsCapture && IsCheck == other.IsCheck && IsCheckmate == other.IsCheckmate; }
public ErrorCodes PlayMove(MoveDesc move) { var is_ok = m_tree.MakeChildNewRoot(move.From, move.To, move.PromoteTo); if (is_ok) { CurrentGame.m_moves.Add(move); } else { // TODO - should we reset the game, or should we ignore move command? InitNewGame(); } return is_ok ? ErrorCodes.Success : ErrorCodes.InvalidMove; }
public static string ToCoordinateNotation(MoveDesc move) { return move.From.ToString() + move.To.ToString() + (move.IsPromotion ? GetPieceString(move.PromoteTo).ToLower() : string.Empty); }