public void StartInfiniteAnalysis() { Flags.IsInfiniteAnalysisOn = true; //Clock.Reset(0, 0); Clock.Reset(); if (StartAnalysis != null) { StartAnalysis(this, EventArgs.Empty); } }
void moveToWorker_DoWork(object sender, DoWorkEventArgs e) { if (BeforePaste != null) { BeforePaste(this, EventArgs.Empty); } DataTable moves = e.Argument as DataTable; Moves.DataTable.Clear(); Notations.NotationView.Clear(); bool b = Flags.IsEngineOn; Flags.IsEngineOn = false; AddMoves(moves); Flags.IsEngineOn = b; if (Flags.IsOffline) { CurrentMove = RootMove.Clone(); Clock.Reset(); Clock.Stop(); GameResult = GameResultE.InProgress; } }
public void Paste(DataTable moves) { if (BeforePaste != null) { BeforePaste(this, EventArgs.Empty); } Notations.Game.Moves.DataTable.Clear(); Notations.NotationView.Clear(); bool b = Flags.IsEngineOn; Flags.IsEngineOn = false; AddMoves(moves); Flags.IsEngineOn = b; if (Flags.IsOffline) { MoveTo(MoveToE.First); CurrentMove = null; Clock.Reset(); Clock.Stop(); GameResult = GameResultE.InProgress; } if (AfterPaste != null) { AfterPaste(this, EventArgs.Empty); } }
private void SetSuddenDeathMatchTime() { if (Flags.IsSuddenDeathMatch) { long wt = DbGame.TournamentMatch.Tournament.SuddenDeathWhiteMin * 60; long bt = DbGame.TournamentMatch.Tournament.SuddenDeathBlackMin * 60; long gain = DbGame.TournamentMatch.Tournament.SuddenDeathSec; Clock.Reset(wt + gain, bt + gain); GameTime.GainPerMove = gain; } }
public void SetFen(string fen) { if (string.IsNullOrEmpty(fen) || !GameValidator.IsValidFen(fen)) { return; } if (BeforeSetFen != null) { BeforeSetFen(this, EventArgs.Empty); } GameValidator = new GameW(fen); if (Flags.IsOffline) { if (Flags.IsClickedByUser) { if (IsSwapPlayersRequired) { SwapPlayers(); } } else { Clock.Reset(); Clock.Stop(); GameResult = GameResultE.InProgress; } Flags.EnPassant = SquareE.NoSquare; ResetCounters(); } if (AfterSetFen != null) { AfterSetFen(this, EventArgs.Empty); } }
private bool StartNewPhase(int phase) { long gameTime = 0; switch (phase) { case 2: if (GameTime.SecondHour > 0 || GameTime.SecondMin > 0) { gameTime = GameTime.GetSeconds(GameTime.SecondHour, GameTime.SecondMin, GameTime.SecondGainPerMoves); Clock.Reset(gameTime + Clock.WhiteTime, gameTime + Clock.BlackTime); GameTime.LongGamePhase = phase; GameTime.GainPerMove = GameTime.SecondGainPerMoves; return(true); } break; case 3: if (((CurrentLine.Count / 2) - GameTime.FirstMoves) == GameTime.SecondMoves) { if (GameTime.ThirdHour > 0 || GameTime.ThirdMin > 0) { gameTime = GameTime.GetSeconds(GameTime.ThirdHour, GameTime.ThirdMin, GameTime.ThirdGainPerMoves); Clock.Reset(gameTime + Clock.WhiteTime, gameTime + Clock.BlackTime); GameTime.LongGamePhase = phase; GameTime.GainPerMove = GameTime.ThirdGainPerMoves; return(true); } } break; default: break; } return(false); }