Beispiel #1
0
        public Situation Simulate(Pod pod1, Pod pod2, Pod opp1, Pod opp2, GameMove[] moves, bool Opp = false)
        {
            var strategy = new SimpleStrategy();

            Console.SetError(StreamWriter.Null);
            var fastStrat = new FastStrategy(OppDepth);

            if (!Opp)
            {
                moves[2] = strategy.GetMove(opp1);
                moves[3] = strategy.GetMove(opp2);
            }
            else
            {
                GameMove[] oppMoves = fastStrat.GetMoves(new Pod[] { opp1, opp2 }, new Pod[] { pod1, pod2 });
                moves[2] = oppMoves[0];
                moves[3] = oppMoves[1];
            }

            var standardError = new StreamWriter(Console.OpenStandardError());
            standardError.AutoFlush = true;
            Console.SetError(standardError);

            Pod[] sPod = new Pod[4];
            sPod[0] = new Pod(pod1); sPod[1] = new Pod(pod2);
            sPod[2] = new Pod(opp1); sPod[3] = new Pod(opp2);
            Pod.UpdatePos(sPod, moves);

            GameMove[] moves2 = new GameMove[4];

            GameMove.Copy(moves, moves2, 4);

            for (int i = 0; i < SimpleSimDepth; i++)
            {
                moves2[0] = strategy.GetMove(sPod[0]);
                moves2[1] = strategy.GetMove(sPod[1]);
                moves2[2] = strategy.GetMove(sPod[2]);
                moves2[3] = strategy.GetMove(sPod[3]);
                Pod.UpdatePos(sPod, moves2);
            }

            return new Situation(sPod);
        }
Beispiel #2
0
 static void Main(string[] args)
 {
     InitialInput();
     Simulator sim = new Simulator();
     int count = 0;
     int mainDepth = C - 1;
     while (true)
     {
         count++;
         for (int i = 0; i < 2; i++)
         {
             pod[i].Update(Console.ReadLine());
         }
         for (int i = 0; i < 2; i++)
         {
             opp[i].Update(Console.ReadLine());
         }
         var strategy = new SimpleStrategy();
         GameMove[] moves = new GameMove[4];
         if (count < 7)
         {
             moves[0] = strategy.GetMove(pod[0]);
             moves[1] = strategy.GetMove(pod[1]);
         }
         else if (count < 50)
         {
             var faststrategy = new FastStrategy();
             moves = faststrategy.GetMoves(pod, opp);
         }
         else
         {
             var hitandrun = new HitStrategy();
             moves = hitandrun.GetMoves(pod, opp);
         }
         if (count == 1)
         {
             moves[0].Thrust = 200;
             moves[1].Thrust = 200;
         }
         moves[0].Print();
         moves[1].Print();
     }
 }