コード例 #1
0
        /// <summary>
        /// Initializes the round.
        /// </summary>
        /// <param name="context">The world context.</param>
        public override void InitializeRound(IWorldContext context)
        {
            m_board = new TicTacToeBoard();
            m_noughtBotEnviromentContext = new TicTacToeEnvironmentContext();
            m_crossBotEnviromentContext  = new TicTacToeEnvironmentContext();
            m_upateResult = new TicTacToeEnvironmentUpdateResult();

            var bots = context.GetBotsWithKindOfAbility <ITicTacToeBotAbility>();

            m_crossBot        = bots[0];
            m_crossBotAbility = (ITicTacToeBotAbility)context.GetBotAbility <ITicTacToeBotAbility>(m_crossBot);
            m_crossBotEnviromentContext.Board             = m_board;
            m_crossBotEnviromentContext.MySpaceType       = SpaceType.Cross;
            m_crossBotEnviromentContext.OpponentSpaceType = SpaceType.Nought;

            m_noughtBot        = bots[1];
            m_noughtBotAbility = (ITicTacToeBotAbility)context.GetBotAbility <ITicTacToeBotAbility>(m_noughtBot);
            m_noughtBotEnviromentContext.Board             = m_board;
            m_noughtBotEnviromentContext.MySpaceType       = SpaceType.Nought;
            m_noughtBotEnviromentContext.OpponentSpaceType = SpaceType.Cross;

            m_winnerSpaces = new ITicTacToeBoardSpace[0];
        }
コード例 #2
0
 /// <summary>
 /// Initializes the environment using the world context specified.
 /// </summary>
 /// <param name="context">The world context.</param>
 public override void  Initialize(IWorldContext context)
 {
     m_board = new TicTacToeBoard();
 }