Beispiel #1
0
        public static void Main()
        {
            int maxValue  = 7184300;
            int nrPlayers = 468;

            long[] players       = new long[nrPlayers];
            int    playercounter = 0;
            marble current       = new marble();
            marble zero          = current;

            current.initiate(current, current, 0);
            current.getClockwise().setCounterClockwise(current);
            for (int i = 1; i <= maxValue; i++)
            {
                if (i % 23 != 0)
                {
                    current = current.addNewAsCurrent(i);
                    current.getClockwise().setCounterClockwise(current);
                }
                else
                {
                    players[playercounter] += i; //lägg till score till player
                    current = current.remove(7);
                    players[playercounter] += current.getValue();
                    current = current.getClockwise();
                }
                playercounter = (playercounter + 1) % nrPlayers;
                //zero.write(current.getValue());
                //Console.WriteLine();
            }
            long answer1 = players[findMaxPlayer(players)];

            Console.Write("Svar1: ");
            Console.WriteLine(answer1);
        }
Beispiel #2
0
 public marble remove(int time)
 {
     //Console.WriteLine();
     // Console.Write(value);
     if (time == 0)
     {
         clockwise.setCounterClockwise(counterClockwise);
         counterClockwise.setClockwise(clockwise);
         return(this);
     }
     else
     {
         return(counterClockwise.remove(time - 1));
     }
 }