/// <summary> /// Menu handler for "File->New Game" /// </summary> /// <param name="sender">Ignored</param> /// <param name="e">Ignored</param> private void newGameToolStripNewGame_Click(object sender, EventArgs e) { NewGameDialog newGameDialog = new NewGameDialog(NewGameDialog.NewGameType.Normal); DialogResult result = newGameDialog.ShowDialog(this); if (result == DialogResult.OK) { NewGame(newGameDialog.Info.Type, String.Empty, newGameDialog.Info.PlayerColor, newGameDialog.Info.ThinkTime); } }
/// <summary> /// Opens a dialog to accept a FEN string. If that is successful, it sends /// the FEN string to the ChessGame instance (assuming we have one) /// </summary> /// <param name="sender">Ignored</param> /// <param name="e">Ignored</param> private void newPositionToolStripNewPosition_Click(object sender, EventArgs e) { // Opens a dialog to read the FEN string and then passes it to engine NewGameDialog newGameDialog = new NewGameDialog(NewGameDialog.NewGameType.PositionalFEN); DialogResult result = newGameDialog.ShowDialog(this); if (result == DialogResult.OK) { NewGame(newGameDialog.Info.Type, newGameDialog.StartingPosition, PieceColor.White, newGameDialog.Info.ThinkTime); } }
/// <summary> /// Menu handler for File->Self Play /// </summary> /// <param name="sender">Ignored</param> /// <param name="e">Ignored</param> private void selfPlayToolStripSelfPlay_Click(object sender, EventArgs e) { SelfPlayResultEventArgs spea = e as SelfPlayResultEventArgs; // Check if this is an event from our handler if (spea != null && (spea.Continue)) { NewGame(TypeGame.Clasic, String.Empty, PieceColor.White, selfPlayThinkTime); chessGame?.StartEngineSelfPlay(); } else { // Otherwise, pop a new dialog for the thinktime NewGameDialog newGameDialog = new NewGameDialog(NewGameDialog.NewGameType.SelfPlay); DialogResult result = newGameDialog.ShowDialog(this); if (result == DialogResult.OK) { selfPlayThinkTime = newGameDialog.Info.ThinkTime; NewGame(newGameDialog.Info.Type, String.Empty, PieceColor.White, selfPlayThinkTime); chessGame?.StartEngineSelfPlay(); } } }