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); }
public marble addNewAsCurrent(int valueIn) { marble newMarble = new marble(); newMarble.initiate(clockwise.getClockwise(), clockwise, valueIn); clockwise.setClockwise(newMarble); return(newMarble); }