public void SetMove(Move m) { if (m.Id == CurrentMove.Id) { return; } CurrentMove = m; Flags.IsMoveInProgress = true; Flags.IsClickedByUser = true; Clock.Stop(); Clock.SetClock(CurrentMove); Flags.IsRetracMove = false; Flags.IsMoveInProgress = false; Notations.Set(); Book.MoveTo(); SetFen(CurrentMove.Fen); //SetCapturedPiecesParameters(); //CapturedPieces.MoveTo(moveTo); }
public void MoveTo(Move m) { if (m == null) { return; } if (m.Id == CurrentMove.Id) { return; } if (BeforeMoveTo != null) { BeforeMoveTo(this, new MoveToEventArgs(m)); } Flags.IsRetracMove = false; CurrentMove = m.Clone(); Clock.MoveTo(CurrentMove); Notations.MoveTo(CurrentMove); Book.MoveTo(CurrentMove); CapturedPieces.MoveTo(CurrentMove); SetFen(CurrentMove.Fen); SwapPlayersIfNeeded(); if (AfterMoveTo != null) { AfterMoveTo(this, new MoveToEventArgs(CurrentMove)); } }
public void MoveTo(int moveNo) { Notations.MoveTo(moveNo); Book.MoveTo(moveNo); SetCapturedPiecesParameters(); CapturedPieces.MoveTo(moveNo); }
public void AddMoves(DataTable moves) { moves.DefaultView.Sort = "Id Asc"; moves = moves.DefaultView.ToTable(moves.TableName); Move m = null; for (int i = 0; i < moves.Rows.Count; i++) { m = new Move(moves.Rows[i]); m.Game = this; if (Flags.IsOnline && i == moves.Rows.Count - 1 && !Flags.IsGameFinished) { AddMove(m.From, m.To, m.Piece, m.Fen, m, false); MoveTo(MoveToE.Last); DoEngineMoveIfNeeded(); } else { CurrentMove = m; Notations.AddMove(m); Moves.Import(m); SetCurrentLine(m); } } if (Flags.IsOffline || (Flags.IsOnline && Flags.IsGameFinished)) { MoveTo(MoveToE.Last); } }
public Scoring(Notations notations, Game game) { this.Game = game; Notations = notations; ScoringData = GetScoringDataTable(); ScoringView = GetScoringViewTable(); }
public void SetMove(int r, int c) { NotationDataRow nd = Notations.GetNotationDataRow(r, c); Move m = Moves.GetByID(nd.Id); SetMove(m); }
public DataTable GetGamesByNotation(Notations notation, int rowIndex, int colIndex) { List <GameItem> gameItems = new List <GameItem>(); foreach (DataRow row in this.Database.DatabaseData.Rows) { Move m = new Move(row); m.Game = this.Game; //string moves = m.DoubleNotation; GameItem gameItem = new GameItem(row); DataTable dbGameMoves = gameItem.Moves.Notation.NotationView; DataTable currentGameMoves = this.Game.Notations.NotationView; Notations n = new Notations(gameItem.GameData.Game); DataTable myMoves = n.NotationView; // string currentGameMoves = notation.Moves.GetMovesString(rowIndex,colIndex); // string databaseGameMoves = gameItem.Moves.GetMovesString(rowIndex, colIndex); /* * * if (currentGameMoves == databaseGameMoves) * { * serialNo++; * DataRow gameDataRow = GamesData.NewRow(); * gameDataRow[SerialNo] = serialNo; * gameDataRow[Guid] = gameItem.GameData.Guid; * gameDataRow[Players] = gameItem.GameData.GamePlayers; * gameDataRow[Tournament] = gameItem.GameData.Tournament; * gameDataRow[ECO] = gameItem.GameData.EcoCode; * gameDataRow[Year] = gameItem.GameData.Year; * gameDataRow[Result] = gameItem.GameData.Result; * * if (Ap.Options.IsSingleNotation) * { * // single * //this.Game.Notations.GetSingleNotation(); * //this.Game.Notations.MovesDisplay.Rows; * DataTable dbGameMoves= gameItem.Moves.Notation.MovesDisplay(); * DataTable currentGameMoves = this.Game.Notations.MovesDisplay(); * * } * else * { * //double * } * if (gameItem.Moves != null) * { * gameDataRow[Variation] = Notations.HasVariation(gameItem.Moves.DataTable) ? "V" : ""; * } * * * GamesData.Rows.Add(gameDataRow); * } */ } return(DataTable); }
public string GetOnlineGameXml() { DataRow dr = Notations.GetLastRow(); if (dr != null) { return(UData.ToString(dr)); } else { return(""); } }
public Game() { Flags = new GameFlags(this); PlayingMode = new PlayingMode(this); Clipboard = new Clipboard(this); Notations = new Notations(this); GameTime = new GameTime(this); GameData = new GameData(this); EngineParameters = new EngineParameters(this); Book = new Book(this); Clock = new Clock(this); Player1 = new Player(PlayerColorE.White); Player2 = new Player(PlayerColorE.Black); }
public Game() { RootMove = GetRootMove(); CurrentMove = RootMove.Clone(); Flags = new GameFlags(this); //PlayingMode = new PlayingMode(this); Clipboard = new Clipboard(this); Notations = new Notations(this); GameTime = new GameTime(this); GameData = new GameData(this); Book = new Book(this); Clock = new Clock(this); CapturedPieces = new CapturedPieces(this); Moves = new Moves(this); GameValidator = new GameW(this.InitialBoardFen); Player1 = new Player(this, PlayerColorE.White); Player2 = new Player(this, PlayerColorE.Black); }
public void Paste(DataTable moves) { if (BeforePaste != null) { BeforePaste(this, EventArgs.Empty); } Moves.DataTable.Clear(); Notations.NotationView.Clear(); AddMoves(moves); if (Flags.IsOffline) { // as now on paste, we set last move selected, // so currentMove points to that last move // and also clock is set by that move. //CurrentMove = RootMove.Clone(); //Clock.Reset(); Clock.Stop(); GameResult = GameResultE.InProgress; } else { Notations.GameFinished(); if (GameResult != GameResultE.InProgress) { Clock.Stop(); } } if (AfterPaste != null) { AfterPaste(this, EventArgs.Empty); } }
public void MoveTo(MoveToE moveTo) { Move m = null; switch (moveTo) { case MoveToE.First: m = Moves.First; //Notations.MoveTo(moveTo); break; case MoveToE.Last: m = Moves.Last; break; case MoveToE.Next: m = Moves.Next(CurrentMove); //Notations.MoveTo(moveTo); break; case MoveToE.Previous: m = Moves.Prev(CurrentMove); //Notations.MoveTo(moveTo); break; case MoveToE.Up: break; case MoveToE.Down: break; default: break; } if (m == null && moveTo == MoveToE.Previous) { return; } if (m == null) { Book.MoveTo(moveTo, true); return; } if (CurrentMove.Id == m.Id) { Book.MoveTo(moveTo, true); } else { CurrentMove = m.Clone(); Flags.IsMoveInProgress = true; Flags.IsClickedByUser = true; Clock.Stop(); Clock.SetClock(CurrentMove); Flags.IsRetracMove = false; Flags.IsMoveInProgress = false; Notations.Set(); Book.MoveTo(moveTo, false); SetCapturedPiecesParameters(); CapturedPieces.MoveTo(moveTo); SetFen(CurrentMove.Fen); } }
public Moves(Notations notation) { this.Notation = notation; DataTable = GetMovesTable(); }
private void DoNewGame(string fen, GameMode gameMode, GameType gameType, OptionsBlitzClock blitzClock, OptionsLongClock longClock) { NewGameEventArgs args = new NewGameEventArgs(); if (BeforeNewGame != null) { BeforeNewGame(this, args); } if (args.Cancel) { return; } if (SaveDocking != null) { SaveDocking(this, EventArgs.Empty); } GameStartTimeLocal = DateTime.Now; Ap.Options.CurrentGameGuid = string.Empty; Stop(); InitialBoardFen = fen; PreviousGameMode = GameMode; PreviousPonderMove = string.Empty; GameMode = gameMode; GameType = gameType; #region Init //GameValidator = new GameW(this.InitialBoardFen); GameValidator.SetFen(this.InitialBoardFen); SpaceBarCounter = 0; CloseEngines(); if (GameType == GameType.Long) { GameTime.Init(longClock, true); } else { GameTime.Init(blitzClock, true); } if (Flags.IsBookLoadRequired) { Book.Load(null); } GameResult = GameResultE.InProgress; Reset(); if (DbGame != null && DbGame.IsFinished) { this.GameResult = DbGame.GameResultIDE; this.Flags.SetFlags(DbGame.GameFlags); } CurrentMove = RootMove.Clone(); Moves.Clear(); CurrentLine = null; #endregion #region Switch GameMode switch (GameMode) { case GameMode.None: break; case GameMode.HumanVsHuman: #region HumanVsHuman GameTime.TimeMin = 0; GameTime.GainPerMove = 0; Player1.Engine = null; Player2.Engine = null; Player2.Book = Book; Player1.PlayerTitle = Ap.UserProfile.LastName; Player2.PlayerTitle = "InfinityChess"; GameData.SetPlayers(Player1.PlayerTitle, Ap.UserProfile.FirstName, Player2.PlayerTitle, ""); gameTypeTitle = Ap.GetGameTypeTitle(GameType); #endregion break; case GameMode.HumanVsEngine: #region HumanVsEngine Player2EngineFileName = InfinitySettings.Settings.DefaultEngineXml.FilePath; Player1.Engine = null; if (DefaultEngine == null) { Player2.Engine = UCIEngine.Load(Player2EngineFileName, Options.DefaultHashTableSize, this); Player2.Engine.UseTablebases = Ap.EngineOptions.UseTablebases; DefaultEngine = Player2.Engine; } else { Player2.Engine = DefaultEngine; } Player2.Book = Book; DefaultBook = Player2.Book; Player1.PlayerTitle = Ap.UserProfile.LastName; Player2.PlayerTitle = Player2.Engine.EngineName; GameData.SetPlayers(Player1.PlayerTitle, Ap.UserProfile.FirstName, Player2.PlayerTitle, ""); gameTypeTitle = Ap.GetGameTypeTitle(GameType); #endregion break; case GameMode.EngineVsEngine: #region EngineVsEngine Player1.Engine = UCIEngine.Load(Player1EngineFileName, Player1EngineHashTableSize, this); Player1.Engine.UseTablebases = Ap.EngineOptions.UseTablebases; Player2.Engine = UCIEngine.Load(Player2EngineFileName, Player2EngineHashTableSize, this); Player2.Engine.UseTablebases = Ap.EngineOptions.UseTablebases; Player1.PlayerTitle = Player1.Engine.EngineName; Player2.PlayerTitle = Player2.Engine.EngineName; if (Player1.Book != null) { Player1.Book.NewGame(); } if (Player2.Book != null) { Player2.Book.NewGame(); } GameData.SetPlayers(Player1.PlayerTitle, "", Player2.PlayerTitle, ""); gameTypeTitle = Ap.GetGameTypeTitle(GameType); InitE2eResult(); #endregion break; case GameMode.OnlineHumanVsHuman: #region OnlineHumanVsHuman StartOnlineH2HGame(); #endregion break; case GameMode.OnlineHumanVsEngine: #region OnlineHumanVsEngine gameTypeTitle = Ap.GetGameTypeTitle(GameType); #endregion break; case GameMode.OnlineEngineVsEngine: #region OnlineEngineVsEngine if (Ap.PlayingMode.SelectedEngine == null) { StartOnlineH2HGame(); } else { StartOnlineE2EGame(); } #endregion break; case GameMode.Kibitzer: #region Kibitzer GameTime.Set(DbGame); GameResult = DbGame.GameResultIDE; Player1.PlayerTitle = DbGame.WhiteUser.UserName + " " + DbGame.WhiteUser.Engine.Name; Player2.PlayerTitle = DbGame.BlackUser.UserName + " " + DbGame.BlackUser.Engine.Name; if (DbGame.IsRated) { gameTypeTitle = GameType.ToString() + " " + DbGame.TimeMin.ToString() + "' + " + DbGame.GainPerMoveMin.ToString() + "'', " + "Rated"; if (DbGame.EloBlackBefore != 0 && !DbGame.BlackUser.IsGuest) { Player2.PlayerTitle += " " + DbGame.EloBlackBefore.ToString(); } if (DbGame.EloWhiteBefore != 0 && !DbGame.WhiteUser.IsGuest) { Player1.PlayerTitle += " " + DbGame.EloWhiteBefore.ToString(); } } else { gameTypeTitle = GameType.ToString() + " " + DbGame.TimeMin.ToString() + "' + " + DbGame.GainPerMoveMin.ToString() + "'', " + "Unrated"; } GameData.SetPlayers(Player1.PlayerTitle, "", Player2.PlayerTitle, ""); #endregion break; default: break; } #endregion if (DefaultEngine != null) { if (DefaultEngine.IsClosed) { DefaultEngine.Load(); } } Flags.IsEngineBlack = true; #region Start Clock.NewGame(); Notations.NewGame(); if (Flags.IsBookLoadRequired) { Book.NewGame(); } CapturedPieces.NewGame(); GameData.NewGame(); Clipboard.Reset(); GameData.Tournament = GameTypeTitle; Ap.Options.GameType = gameType; Ap.Options.Save(); #endregion if (CreateDocking != null) { CreateDocking(this, EventArgs.Empty); } Flags.IsInfiniteAnalysisOn = false; MediaPlayer.PlaySound(SoundFileNameE.SetPieces); SetFen(fen); Flags.IsBoardSetByFen = fen != ChessLibrary.FenParser.InitialBoardFen; if (Flags.IsOnline && DbGame != null) { Flags.IsChallengerSendsGame = DbGame.IsChallengerSendsGame; } SetSuddenDeathMatchTime(); if (AfterNewGame != null) { AfterNewGame(this, EventArgs.Empty); } }
public void NewGame(string fen, GameMode gameMode, GameType gameType, OptionsBlitzClock blitzClock, OptionsLongClock longClock) { Stop(); InitialBoardFen = fen; GameMode = gameMode; GameType = gameType; if (BeforeNewGame != null) { BeforeNewGame(this, EventArgs.Empty); } #region Init GameValidator = new GameW(this.InitialBoardFen); SpaceBarCounter = 0; CloseEngines(); if (GameType == GameType.LongGame) { GameTime.Init(longClock, true); } else { GameTime.Init(blitzClock, true); } GameResult = GameResultE.InProgress; CurrentMove = null; Flags.Reset(); #endregion #region Switch gameMode switch (GameMode) { case GameMode.None: break; case GameMode.HumanVsHuman: Player1.PlayerType = PlayerType.Human; Player2.PlayerType = PlayerType.Human; Player1.Engine = null; Player2.Engine = null; Player1.PlayerTitle = GameData.WhiteTitle; Player2.PlayerTitle = GameData.BlackTitle; break; case GameMode.HumanVsEngine: Player1.PlayerType = PlayerType.Human; Player2.PlayerType = PlayerType.Engine; Player2EngineFileName = InfinitySettings.Settings.DefaultEngineXml.FilePath; Player1.Engine = null; if (DefaultEngine == null) { Player2.Engine = UCIEngine.Load(Player2EngineFileName, Options.DefaultHashTableSize); Player2.Engine.UseTablebases = EngineParameters.UseTablebases; DefaultEngine = Player2.Engine; } else { Player2.Engine = DefaultEngine; } Player2.Book = Book; DefaultBook = Player2.Book; Player1.PlayerTitle = Ap.UserProfile.LastName; Player2.PlayerTitle = Player2.Engine.EngineName; break; case GameMode.EngineVsEngine: Player1.PlayerType = PlayerType.Engine; Player2.PlayerType = PlayerType.Engine; Player1.Engine = UCIEngine.Load(Player1EngineFileName, Player1EngineHashTableSize); Player1.Engine.UseTablebases = EngineParameters.UseTablebases; Player2.Engine = UCIEngine.Load(Player2EngineFileName, Player2EngineHashTableSize); Player2.Engine.UseTablebases = EngineParameters.UseTablebases; Player1.PlayerTitle = Player1.Engine.EngineName; Player2.PlayerTitle = Player2.Engine.EngineName; break; case GameMode.OnlineHumanVsHuman: #region OnlineHumanVsHuman StartOnlineH2HGame(); #endregion break; case GameMode.OnlineHumanVsEngine: break; case GameMode.OnlineEngineVsEngine: if (PlayingMode.SelectedEngine == null) { StartOnlineH2HGame(); } else { StartOnlineE2EGame(); } break; case GameMode.Kibitzer: #region Kibitzer GameTime.Set(DbGame); GameResult = DbGame.GameResultIDE; //GameResultE.InProgress; Player1.PlayerType = PlayerType.Human; Player1.PlayerTitle = DbGame.WhiteUser.UserName; Player2.PlayerType = PlayerType.Human; Player2.PlayerTitle = DbGame.BlackUser.UserName; if (DbGame.IsRated) { gameTypeTitle = GameType.ToString() + " " + DbGame.TimeMin.ToString() + "m + " + DbGame.GainPerMoveMin.ToString() + "s, " + "Rated"; if (DbGame.EloBlackBefore != 0 && !DbGame.BlackUser.IsGuest) { Player2.PlayerTitle += " " + DbGame.EloBlackBefore.ToString(); } if (DbGame.EloWhiteBefore != 0 && !DbGame.WhiteUser.IsGuest) { Player1.PlayerTitle += " " + DbGame.EloWhiteBefore.ToString(); } } else { gameTypeTitle = GameType.ToString() + " " + DbGame.TimeMin.ToString() + "m + " + DbGame.GainPerMoveMin.ToString() + "s, " + "Unrated"; } #endregion break; default: break; } #endregion if (DefaultEngine != null) { if (DefaultEngine.IsClosed) { DefaultEngine.Load(); } } Flags.IsEngineBlack = true; #region Start gameTypeTitle = Ap.GetGameTypeTitle(GameType); Player1.Active = true; Player2.Active = false; Notations.SetupNewGame(); CapturedPieces.SetupNewGame(); Clock.SetupNewGame(); Book.SetupNewGame(); Clipboard.Reset(); CurrentPlayer = Player1; GameData.SetupNewGame(); if (Flags.IsChangeNamesAllowed) { GameData.White1 = Player1.PlayerTitle; GameData.White2 = Ap.UserProfile.FirstName; GameData.Black1 = Player2.PlayerTitle; } GameData.Tournament = GameTypeTitle; InitTablebases(); Ap.Options.GameType = gameType; Ap.Options.Save(); #endregion if (CreateDocking != null) { CreateDocking(this, EventArgs.Empty); } Flags.IsInfiniteAnalysisOn = false; SetFen(fen); if (Flags.IsOnline) { // Flags.IsChallengerSendsGame = Flags.IsPositionSetupAllowed; } if (AfterNewGame != null) { AfterNewGame(this, EventArgs.Empty); } }
public Move AddMove(string from, string to, Pieces fromPiece, string fen, Move m, bool isSetFen) { #region On Before if (m == null) { return(null); } if (BeforeAddMove != null) { EngineMoveEventArgs em = new EngineMoveEventArgs(); em.BestMove = from + to; em.PonderMove = PonderMove; BeforeAddMove(this, em); } #endregion #region Before CurrentMove Import if (Flags.IsOnline && Flags.IsGameFinished) // due to time expire etc. { return(null); } if (Flags.IsOnline && (Flags.IsNotMyTurn || Flags.IsGameFinished)) { Clock.ToggleClock(m); } else { #region Prepare Move if (!m.Flags.IsPromotion) // promoted piece is already assigned in promotion dialog { m.Piece = fromPiece; } m.Id = NextMoveId; m.Pid = NextMovePid; m.MoveNo = NextMoveNo; m.IsWhite = NextMoveIsWhite; m.From = from; m.To = to; m.Fen = fen; if (Flags.IsEvalRequired) { if (!String.IsNullOrEmpty(CurrentPlayer.Engine.Points) && !String.IsNullOrEmpty(CurrentPlayer.Engine.Depth)) { m.SetEval(CurrentPlayer.Engine.Points, CurrentPlayer.Engine.Depth); } } if (Flags.IsExpectedMoveRequired) { if (!String.IsNullOrEmpty(CurrentPlayer.Engine.ExpectedMove)) { m.ExpectedMove = CurrentPlayer.Engine.ExpectedMove; } } #endregion #region IsVariation if (AddVariationMove(m)) { PlaySounds(m); return(null); } else { m.Flags.VariationType = this.VariationType; } #endregion #region Set Clock if (Flags.IsOnline) { if (!m.IsWhite) { Clock.WhiteTime += DbGame.GainPerMoveMin; } else { Clock.BlackTime += DbGame.GainPerMoveMin; } } else { if (m.IsWhite) { Clock.BlackTime += GameTime.GainPerMove; } else { Clock.WhiteTime += GameTime.GainPerMove; } } m.MoveTimeWhite = Clock.WhiteTime; m.MoveTimeBlack = Clock.BlackTime; m.MoveTime = Clock.MoveTime; if (this.Flags.IsFirtMove && this.Flags.IsInfiniteAnalysisOff) { Clock.Start(); } #endregion } #endregion Notations.AddMove(m); CurrentMove = m.Clone(); Moves.Import(CurrentMove); #region After CurrentMove Import SetCurrentLine(CurrentMove); CheckNextLongGamePhase(CurrentMove); CheckThreefoldRepetition(); SetCastlingFlags(CurrentMove.Piece, CurrentMove.From, CurrentMove.To); Flags.IsPieceMovedSuccessfully = true; #region Point Book if (GameMode != GameMode.EngineVsEngine && GameMode != GameMode.OnlineEngineVsEngine) { Book.PointTo(CurrentMove); } #endregion #region Update Captured Pieces if (CurrentMove.Flags.IsCapture) { CapturedPieces.Update(CurrentMove); } #endregion Flags.IsMoveInProgress = false; Flags.IsForceEngineToMove = false; #region Check Game Finish if (!Flags.IsDatabaseGame) { #region Mated if (Flags.IsMated) { Mated(); Flags.IsMoveInProgress = true; } #endregion #region StaleMated if (Flags.IsStaleMated) { StaleMated(); } #endregion #region ThreefoldRepetition if (Flags.IsThreeFoldRepetition) { ThreefoldRepetition(false); } #endregion #region InsufficientMaterial if (Flags.IsInsufficientMaterial) { InsufficientMaterial(); } #endregion } #endregion #region SetFen if (isSetFen) { SetFen(CurrentMove.Fen); } #endregion #region FifityMoves if (this.HalfMovesCounter >= 100) { FifityMoves(); } #endregion #region Set ECO, Play Sound etc. SearchEco(); CheckMoveLimit(); PlaySounds(m); Clock.ResetMoveTime(); VariationType = VariationTypeE.None; if (Flags.IsClockStartRequired) { Clock.Start(); } #endregion #region Send Move To Opponent if (Flags.IsUpdateGameRequired) { SocketClient.UpdateGameDataByGameID(DbGame.GameID, GetLastMoveXml(), GameResult, Flags.Flags, DbGame.OpponentUserID); } #endregion #endregion #region On After if (AfterAddMove != null) { AfterAddMove(this, EventArgs.Empty); } #endregion return(CurrentMove); }
public void MoveTo(MoveToE moveTo, bool moveFromBook) { Move m = null; if ((Flags.IsFirstMoveSelected || Flags.IsRootMoveSelected) && (moveTo == MoveToE.Previous || moveTo == MoveToE.First)) { if (Flags.IsRootMoveSelected) { return; } SetInitialPosition(); return; } if (moveFromBook && moveTo == MoveToE.Next) { Book.MoveTo(moveTo, true); return; } if (Flags.IsFirtMove && moveTo == MoveToE.Next) { return; } switch (moveTo) { case MoveToE.First: m = Moves.First; break; case MoveToE.Last: m = Moves.Last; break; case MoveToE.Next: m = GetNextMove(CurrentMove); break; case MoveToE.Previous: m = Moves.Prev(CurrentMove); break; case MoveToE.Up: break; case MoveToE.Down: break; default: break; } Flags.IsRetracMove = false; CurrentMove = m.Clone(); Clock.MoveTo(moveTo); Notations.MoveTo(moveTo); Book.MoveTo(moveTo, false); CapturedPieces.MoveTo(moveTo); SetFen(CurrentMove.Fen); SwapPlayersIfNeeded(); }
public Move AddMove(string from, string to, Pieces fromPiece, string fen, Move m, bool isPastGame, bool isSetFen) { #region On Before if (m == null) { return(null); } if (BeforeAddMove != null) { BeforeAddMove(this, EventArgs.Empty); } #endregion if (isPastGame) { Clock.SetClock(m); } else { #region IsVariation if (Flags.IsVariation) { if (AddVariationMove()) { return(null); } else { m.Flags.VariationType = this.VariationType; } } #endregion #region Prepare Move if (!m.Flags.IsPromotion) // promoted piece is already assigned in promotion dialog { m.Piece = fromPiece; } m.Id = NextMoveId; m.Pid = NextMovePid; m.MoveNo = NextMoveNo; m.IsWhite = NextMoveIsWhite; m.From = from; m.To = to; m.Fen = fen; #endregion #region Set Clock if (Flags.IsOnline) { if (!m.IsWhite) { Clock.WhiteTime += DbGame.GainPerMoveMin; } else { Clock.BlackTime += DbGame.GainPerMoveMin; } } m.MoveTimeWhite = Clock.WhiteTime; m.MoveTimeBlack = Clock.BlackTime; m.MoveTime = Clock.MoveTime; Clock.Start(); #endregion } CurrentMove = m.Clone(); SetFenCastlingNotation(m.Piece, m.From, m.To); Flags.IsPieceMovedSuccessfully = true; CompareFlags(CurrentMove); Notations.SetMove(CurrentMove); Book.SetMove(CurrentMove); //if (CurrentMove.CapturedPiece != Pieces.NONE) //{ // SetCapturedPiecesParameters(); // CapturedPieces.AddPiece(); //} Flags.IsMoveInProgress = false; Flags.IsForceEngineToMove = false; Flags.IsManualMove = false; Flags.IsSpacebarClick = false; if (Flags.IsMated) { Mated(); Flags.IsMoveInProgress = true; } if (Flags.IsStaleMated) { StaleMated(); } if (Flags.IsThreeFoldRepetition) { ThreefoldRepetition(false); } if (this.HalfMovesCounter >= 100) { FifityMoves(); } TogglePlayers(); if (isSetFen) { SetFen(m.Fen); } Moves.Import(CurrentMove); VariationType = VariationTypeE.None; #region On After if (AfterAddMove != null) { AfterAddMove(this, EventArgs.Empty); } #endregion return(m); }