コード例 #1
0
        public void UpdateGame()
        {
            try {
                string jsonReviced = request.GetRequest(@"/matches");
                beforeGame = JsonConvert.DeserializeObject <List <BeforeGame> >(jsonReviced)[0];

                jsonReviced = request.GetRequest(@"/matches/" + request.GetMatchID());

                onGame = JsonConvert.DeserializeObject <OnGame>(jsonReviced);

                brain.InitBRAIN(beforeGame, onGame);
            }
            catch (Exception) {
                Console.WriteLine("Tu meny riquet");
            }
        }
コード例 #2
0
        public void InitBRAIN(BeforeGame beforeGame, OnGame onGame)
        {
            size        = int.Parse(onGame.Height);
            isObs       = new Map2D <bool>(size);
            scores      = new Map2D <int>(size);
            owns        = new Map2D <int>(size);
            myAgents    = new List <MyAgent>();
            enemyAgents = new List <MyAgent>();

            foreach (var obs in onGame.Obstacles)
            {
                isObs[obs.Y, obs.X] = true;
            }
            foreach (var tre in onGame.Treasure)
            {
                if (tre.Status == 0)
                {
                    scores[tre.Y, tre.X] = tre.Point;
                }
            }
            for (int i = 1; i <= size; i++)
            {
                for (int j = 1; j <= size; j++)
                {
                    scores[i, j] += onGame.Points[i - 1][j - 1];
                    owns[i, j]    = onGame.Tiled[i - 1][j - 1];
                }
            }
            foreach (var tea in onGame.Teams)
            {
                if (tea.TeamID == beforeGame.TeamID)
                {
                    foreach (var age in tea.Agents)
                    {
                        myAgents.Add(new MyAgent(age.Y, age.X, age.AgentID));
                    }
                }
                else
                {
                    foreach (var age in tea.Agents)
                    {
                        enemyAgents.Add(new MyAgent(age.Y, age.X, age.AgentID));
                    }
                }
            }
        }
コード例 #3
0
 public Solution1(BRAIN brain, BeforeGame beforeGame)
 {
     this.brain      = brain;
     this.beforeGame = beforeGame;
 }