Esempio n. 1
0
        /// <summary>
        /// Initializes the round.
        /// </summary>
        /// <param name="context">The world context.</param>
        public override void InitializeRound(IWorldContext context)
        {
            MarkAllCellsUnknown();
            MarkBornAndTargetCells();

            m_environmentContext = new MazeEnvironmentContext(m_map);
            m_environmentContext.SetCellState(m_bornCell.Y, m_bornCell.X, CellState.Visited);
            m_environmentContext.MyCell = m_bornCell;

            m_roundBot        = context.GetBotsWithKindOfAbility <IMazeBotAbility>()[0];
            m_roundBotAbility = (IMazeBotAbility)context.GetBotAbility <IMazeBotAbility>(m_roundBot);
            m_roundBotAbility.Initialize(m_environmentContext);

            m_botRank = null;
        }
Esempio n. 2
0
        private static MazeCell GetBotWishCell(MazeEnvironmentContext ctx, WalkDirection botWalkDirection)
        {
            switch (botWalkDirection)
            {
            case WalkDirection.Down:
                return(new MazeCell(ctx.MyCell.Y + 1, ctx.MyCell.X));

            case WalkDirection.Left:
                return(new MazeCell(ctx.MyCell.Y, ctx.MyCell.X - 1));

            case WalkDirection.Right:
                return(new MazeCell(ctx.MyCell.Y, ctx.MyCell.X + 1));

            default:
                return(new MazeCell(ctx.MyCell.Y - 1, ctx.MyCell.X));
            }
        }