示例#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);
        }
示例#2
0
        public marble addNewAsCurrent(int valueIn)
        {
            marble newMarble = new marble();

            newMarble.initiate(clockwise.getClockwise(), clockwise, valueIn);
            clockwise.setClockwise(newMarble);
            return(newMarble);
        }
示例#3
0
 public void setClockwise(marble clockwiseIn)
 {
     clockwise = clockwiseIn;
 }
示例#4
0
 public void setCounterClockwise(marble counterClockwiseIn)
 {
     counterClockwise = counterClockwiseIn;
 }
示例#5
0
 public void initiate(marble clockwiseIn, marble counterClockwiseIn, int valueIn)
 {
     setClockwise(clockwiseIn);
     setCounterClockwise(counterClockwiseIn);
     value = valueIn;
 }