예제 #1
0
 public Field()
 {
     goalInfo    = GoalInformation.NoInformation;
     distToPiece = int.MaxValue;
     distLearned = DateTime.MinValue;
     deniedMove  = DateTime.MinValue;
 }
예제 #2
0
 public GoalInformation[,] GetRedTeamGoalAreaInformation()
 {
     GoalInformation[,] goalAreaInformation = new GoalInformation[GoalAreaSize, BoardSize.X];
     for (int i = BoardSize.Y - GoalAreaSize + 1; i < BoardSize.Y; i++)
     {
         for (int j = 0; j < BoardSize.X; j++)
         {
             goalAreaInformation[i - BoardSize.Y + GoalAreaSize, j] = Board[i, j].goalInfo;
         }
     }
     return(goalAreaInformation);
 }
예제 #3
0
 public GoalInformation[,] GetBlueTeamGoalAreaInformation()
 {
     GoalInformation[,] goalAreaInformation = new GoalInformation[GoalAreaSize, BoardSize.X];
     for (int i = 0; i < GoalAreaSize; i++)
     {
         for (int j = 0; j < BoardSize.X; j++)
         {
             goalAreaInformation[i, j] = Board[i, j].goalInfo;
         }
     }
     return(goalAreaInformation);
 }
예제 #4
0
        public void ProcessMessage_ExchangeInformationResponsePayload_ShouldUpdateAgentBoardState()
        {
            agent.AgentState = AgentState.InGame;

            var blueGoalAreaInformation = new GoalInformation[, ] {
                { GoalInformation.Goal, GoalInformation.NoGoal, GoalInformation.NoGoal, GoalInformation.NoGoal, GoalInformation.NoInformation }
            };
            var redGoalAreaInformation = new GoalInformation[, ] {
                { GoalInformation.NoInformation, GoalInformation.NoGoal, GoalInformation.NoGoal, GoalInformation.Goal, GoalInformation.NoInformation }
            };
            var distances = new int[, ] {
                { 1, 2, 3, 1, 4 }, { 2, 2, 2, 1, 3 }, { 3, 0, 2, 1, 2 }, { 2, 2, 2, 1, 1 }, { 3, 0, 2, 1, 2 }, { 2, 1, 3, 4, 1 }
            };

            agent.AcceptMessage(GetBaseMessage(new ExchangeInformationResponseForward(2, distances, redGoalAreaInformation, blueGoalAreaInformation), 1));

            //distances are currently being ignored
            //for(int i = 0; i < agent.BoardLogicComponent.BoardSize.Y; i++)
            //{
            //    for(int j = 0; j < agent.BoardLogicComponent.BoardSize.X; j++)
            //    {
            //        Assert.AreEqual(agent.BoardLogicComponent.Board[i, j].distToPiece, distances[i, j]);
            //    }
            //}

            for (int i = 0; i < agent.BoardLogicComponent.GoalAreaSize; i++)
            {
                for (int j = 0; j < agent.BoardLogicComponent.BoardSize.X; j++)
                {
                    Assert.AreEqual(agent.BoardLogicComponent.Board[i, j].goalInfo, blueGoalAreaInformation[i, j]);
                }
            }

            for (int i = agent.BoardLogicComponent.BoardSize.Y - agent.BoardLogicComponent.GoalAreaSize + 1; i < agent.BoardLogicComponent.BoardSize.Y; i++)
            {
                for (int j = 0; j < agent.BoardLogicComponent.BoardSize.X; j++)
                {
                    Assert.AreEqual(agent.BoardLogicComponent.Board[i, j].goalInfo, redGoalAreaInformation[i, j]);
                }
            }
        }