Ejemplo n.º 1
0
        public void Discover()
        {
            currentDegToOpp = Mathematics.getSlope(p1, p2);
            double curr = Mathematics.Degree(OwnRobots.CurrentRobot);

            //double Blockdist = Mathematics.Distance(p1, Objects.Block);
            slope = Mathematics.DegreeToOpp(OwnRobots.CurrentRobot, OppRobots.CurrentRobot);
            ExploreCommander.GoForward();
            // ExploreCommander.Turn(slope, Command.Forward);
            ExploreCommander.Turn(curr + 45, Command.Forward);
            Thread.Sleep(400);
            while (true)
            {
                Dist = Mathematics.Distance(OwnRobots.CurrentRobot, OppRobots.CurrentRobot);
                p1   = OwnRobots.CurrentRobot;
                p2   = OppRobots.CurrentRobot;

                slope = Mathematics.DegreeToOpp(OwnRobots.CurrentRobot, OppRobots.CurrentRobot);
                if (Consts.LastCommand != Command.Forward)
                {
                    ExploreCommander.GoForward();
                    Consts.LastCommand = Command.Forward;
                }

                ExploreCommander.Turn(slope, Command.Forward);
                Follow();
            }
        }
Ejemplo n.º 2
0
        public void Fire()
        {
            p1    = OwnRobots.CurrentRobot;
            p2    = OppRobots.CurrentRobot;
            slope = Mathematics.DegreeToOpp(OwnRobots.CurrentRobot, OppRobots.CurrentRobot);
            double currentDeg = Mathematics.Degree(p1), dist = Mathematics.Distance(OwnRobots.CurrentRobot, OppRobots.CurrentRobot);

            if (Mathematics.IsEqual(currentDeg, slope, 4))
            {
                FireCommander.Fire();
                if (dist > 1000)
                {
                    FireCommander.Shoot();
                }
                Thread.Sleep(100);
            }
        }