public void Each_Tick(object o, EventArgs sender) { if (!ChessBoard.GameFinished) { if (_isWhiteMove) { WhiteSideTime = WhiteSideTime.Add(new TimeSpan(0, 0, 1)); } else { BlackSideTime = BlackSideTime.Add(new TimeSpan(0, 0, 1)); } } }
public void AIMove() { DateTime start = DateTime.Now; Evaluator.BestMove = null; double value = Evaluator.Max(ChessBoard, _isWhiteMove, 0, 0, 0, 0); //MessageBox.Show("Evaluation for " + (_isWhiteMove ? "white: " + value : "black: " + value) // + "\n Best Move: " + Evaluator.BestMove.ToString()); ChessBoard.MakeSpecificMove(Evaluator.BestMove.CopyMove(), _isWhiteMove, true); _isWhiteMove = !_isWhiteMove; ChangeTimersBorderColor(); BlackSideTime = BlackSideTime.Add(new TimeSpan(0, 0, (DateTime.Now - start).Seconds)); }