示例#1
0
    public void Sync()
    {
        string[] inputs = Console.ReadLine().Split(' ');

        this.StopWatch.Restart();

        this.MyScore       = int.Parse(inputs[0]);
        this.OpponentScore = int.Parse(inputs[1]);

        // Reset is alive to false foreach pac
        foreach (Pac p in GetMyPacs())
        {
            p.IsAlive = false;
        }
        /// LOOP PACS
        this.VisiblePacCount = int.Parse(Console.ReadLine());         // all your pacs and enemy pacs in sight

        for (int i = 0; i < this.VisiblePacCount; i++)
        {
            inputs = Console.ReadLine().Split(' ');
            int     pacId           = int.Parse(inputs[0]);                                    // pac number (unique within a team)
            bool    mine            = inputs[1] != "0";                                        // true if this pac is yours
            Vector2 position        = new Vector2(int.Parse(inputs[2]), int.Parse(inputs[3])); // position in the grid
            string  typeId          = inputs[4];                                               // unused in wood leagues
            int     speedTurnsLeft  = int.Parse(inputs[5]);                                    // unused in wood leagues
            int     abilityCooldown = int.Parse(inputs[6]);                                    // unused in wood leagues

            Pac pac = Pacs.Find(e => e.Id == pacId && e.Mine == mine);
            if (pac == null)
            {
                this.Pacs.Add(new Pac(pacId, mine, position, typeId, speedTurnsLeft, abilityCooldown));
            }
            else
            {
                pac.Update(position, typeId, speedTurnsLeft, abilityCooldown);
            }
        }

        // LOOP PELLETS
        this.VisiblePelletCount = int.Parse(Console.ReadLine());         // all pellets in sight
        this.Pellets            = new List <Pellet>(this.VisiblePelletCount);

        for (int i = 0; i < this.VisiblePelletCount; i++)
        {
            inputs = Console.ReadLine().Split(' ');

            Vector2 position = new Vector2(int.Parse(inputs[0]), int.Parse(inputs[1]));
            int     value    = int.Parse(inputs[2]);      // amount of points this pellet is worth
            this.Pellets.Add(new Pellet(position, value));
        }
        this.Grid.Update(this.Pacs, this.Pellets);
    }
示例#2
0
 void button4_Click(object sender, EventArgs e)
 {
     //pacs
     Pacs.SetValue(this.GetCurrentPatient());
     Pacs.Show();
 }