Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GameMode"/> class.
        /// </summary>
        public GameMode()
        {
            _gameSession = new GameSession();
            _gameSession.OnThinkingOutput += GameSession_OnThinkingOutput;

            _csvLogger = new CsvLogger(AILogsDirectory);

            _thinkingOutputEnabled = false;

            _engineColor = Color.Black;
            _enemyColor  = Color.White;

            _gameResultTokens = new Dictionary <string, GameResult>
            {
                { "1-0", GameResult.WhiteWon },
                { "0-1", GameResult.BlackWon },
                { "1/2-1/2", GameResult.Draw }
            };

            CommandsManager.AddCommandHandler(CommandType.Post, ExecutePostCommand);
            CommandsManager.AddCommandHandler(CommandType.NoPost, ExecuteNoPostCommand);
            CommandsManager.AddCommandHandler(CommandType.Time, ExecuteTimeCommand);
            CommandsManager.AddCommandHandler(CommandType.OTim, ExecuteOTimCommand);
            CommandsManager.AddCommandHandler(CommandType.White, ExecuteWhiteCommand);
            CommandsManager.AddCommandHandler(CommandType.Black, ExecuteBlackCommand);
            CommandsManager.AddCommandHandler(CommandType.Go, ExecuteGoCommand);
            CommandsManager.AddCommandHandler(CommandType.UserMove, ExecuteUserMoveCommand);
            CommandsManager.AddCommandHandler(CommandType.Result, ExecuteResultCommand);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Adds all command handlers from current class to the commands manager.
 /// </summary>
 private void SetCommandHandlers()
 {
     CommandsManager.AddCommandHandler(CommandType.AddPiece, CommandGroup.GameMode, AddPiece);
     CommandsManager.AddCommandHandler(CommandType.RemovePiece, CommandGroup.GameMode, RemovePiece);
     CommandsManager.AddCommandHandler(CommandType.MovesTest, CommandGroup.GameMode, DoMovesTest);
     CommandsManager.AddCommandHandler(CommandType.BestMove, CommandGroup.GameMode, CalculateBestMove);
     CommandsManager.AddCommandHandler(CommandType.Quiescence, CommandGroup.GameMode, SetQuiescenceSearch);
     CommandsManager.AddCommandHandler(CommandType.SEE, CommandGroup.GameMode, RunSEE);
     CommandsManager.AddCommandHandler(CommandType.Repetition, CommandGroup.GameMode, CheckThreefoldRepetition);
     CommandsManager.AddCommandHandler(CommandType.Reversible, CommandGroup.GameMode, DisplayReversibleMovesCount);
 }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="InitMode"/> class.
        /// </summary>
        public InitMode()
        {
            _features = new Dictionary <string, bool>
            {
                { "ping", true },
                { "setboard", true },
                { "usermove", true },
                { "done", true }
            };

            CommandsManager.AddCommandHandler(CommandType.ProtoVer, ExecuteProtoVerCommand);
            CommandsManager.AddCommandHandler(CommandType.Rejected, ExecuteRejectedCommand);
            CommandsManager.AddCommandHandler(CommandType.New, ExecuteNewCommand);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Adds all command handlers from current class to the commands manager.
 /// </summary>
 private void SetCommandHandlers()
 {
     CommandsManager.AddCommandHandler(CommandType.Occupancy, CommandGroup.GameMode, DrawOccupancy);
     CommandsManager.AddCommandHandler(CommandType.Attacks, CommandGroup.GameMode, DrawAttacks);
     CommandsManager.AddCommandHandler(CommandType.SaveBoard, CommandGroup.GameMode, SaveBoard);
     CommandsManager.AddCommandHandler(CommandType.LoadBoard, CommandGroup.GameMode, LoadBoard);
     CommandsManager.AddCommandHandler(CommandType.Check, CommandGroup.GameMode, DisplayCheckStatus);
     CommandsManager.AddCommandHandler(CommandType.Mate, CommandGroup.GameMode, DisplayMateStatus);
     CommandsManager.AddCommandHandler(CommandType.Stalemate, CommandGroup.GameMode, DisplayStalemateStatus);
     CommandsManager.AddCommandHandler(CommandType.Castling, CommandGroup.GameMode, DisplayCastlingFlags);
     CommandsManager.AddCommandHandler(CommandType.Evaluation, CommandGroup.GameMode, DisplayEvaluation);
     CommandsManager.AddCommandHandler(CommandType.Hash, CommandGroup.GameMode, DisplayBoardHash);
     CommandsManager.AddCommandHandler(CommandType.Reset, CommandGroup.GameMode, Reset);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Adds all command handlers from current class to the commands manager.
 /// </summary>
 private void SetCommandHandlers()
 {
     _commandsManager.AddCommandHandler(CommandType.Mode, CommandGroup.GUICore, ChangeGameMode);
     _commandsManager.AddCommandHandler(CommandType.Exit, CommandGroup.GUICore, Exit);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Adds all command handlers from current class to the commands manager.
 /// </summary>
 private void SetCommandHandlers()
 {
     CommandsManager.AddCommandHandler(CommandType.RunAIGame, CommandGroup.GameMode, RunAIGame);
 }
 /// <summary>
 /// Adds all command handlers from current class to the commands manager.
 /// </summary>
 private void SetCommandHandlers()
 {
     _commandsManager.AddCommandHandler(CommandType.Help, CommandGroup.ConsoleManager, WriteCommandsList);
     _commandsManager.AddCommandHandler(CommandType.Colors, CommandGroup.ConsoleManager, WriteColorsList);
     _commandsManager.AddCommandHandler(CommandType.Exit, CommandGroup.ConsoleManager, Exit);
 }
Exemplo n.º 8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CECPModeBase"/> class.
        /// </summary>
        protected CECPModeBase()
        {
            CommandsManager = new CommandsManager();

            CommandsManager.AddCommandHandler(CommandType.Ping, ExecutePing);
        }