Exemplo n.º 1
0
 public static void WeakestLink()
 {
     OutputHandler.PrintText("Input N");
     int.TryParse(Console.ReadLine(), out int n);
     OutputHandler.PrintText("Input the order of players choosing");
     int.TryParse(Console.ReadLine(), out int orderOfExclusion);
     OutputHandler.PrinStartGame(orderOfExclusion);
     Engine(n, orderOfExclusion);
 }
Exemplo n.º 2
0
        public static void Engine(int n, int orderOfExclusion)
        {
            int round         = 1;
            int currentChoose = 0;

            if (orderOfExclusion > n)
            {
                throw new ArgumentException("Excluding is impossible becase number of players less than order of excluding", "orderOfExclusion");
            }
            var Players = SetListOfPlayers(n);

            while (Players.Count > orderOfExclusion - 1)
            {
                OutputHandler.PrintRound(round);
                currentChoose = (currentChoose + orderOfExclusion) % Players.Count;
                Players.Remove(Players[currentChoose]);
                OutputHandler.PrintNumberPlayersRemaining(Players.Count);
                round++;
            }
            OutputHandler.PrintEndGame();
        }