Exemple #1
0
        public override int Move(int weight, Gamer Player, out bool isWinner)
        {
            int  tmp;
            bool isUnique = true;

            do
            {
                tmp = rand.Next(40, 140);
                for (int i = 0; i < CountArray; i++)
                {
                    if (Array[i] == tmp)
                    {
                        isUnique = false;
                        break;
                    }
                    isUnique = true;
                }
            } while (!isUnique);
            GameCreator.AllNumbers[GameCreator.CountNamedNumbers] = tmp;
            GameCreator.CountNamedNumbers++;
            Array[CountArray] = tmp;
            Console.WriteLine($"Player 2: {tmp}");
            CountArray++;
            if (tmp == weight)
            {
                GameCreator.Victory(Player);
                isWinner = true;
            }
            else
            {
                isWinner = false;
            }
            return(tmp);
        }
Exemple #2
0
        public override int Move(int weight, Gamer Player, out bool isWinner)
        {
            int  tmp;
            bool isUnique = true;

            do
            {
                tmp = Count;
                Count++;
                for (int i = 0; i < GameCreator.CountNamedNumbers; i++)
                {
                    if (GameCreator.AllNumbers[i] == tmp)
                    {
                        isUnique = false;
                        break;
                    }
                    isUnique = true;
                }
            } while (!isUnique);
            GameCreator.AllNumbers[GameCreator.CountNamedNumbers] = tmp;
            GameCreator.CountNamedNumbers++;
            Console.WriteLine($"Player 5: {tmp}");
            if (tmp == weight)
            {
                GameCreator.Victory(Player);
                isWinner = true;
            }
            else
            {
                isWinner = false;
            }
            return(tmp);
        }
Exemple #3
0
        static void Main(string[] args)
        {
            Console.Write("Enter number of players (2 - 8): ");
            int NumberOfPlayers = NumberCheck();

            Console.WriteLine(NumberOfPlayers);
            GameCreator.CreateList(NumberOfPlayers);
            Random random       = new Random();
            int    BasketWeight = random.Next(40, 140);

            Console.WriteLine($"The weight of the basket is {BasketWeight} kg");
            GameCreator.GameProcess(NumberOfPlayers, basketWeight: BasketWeight);
        }
Exemple #4
0
        public override int Move(int weight, Gamer Player, out bool isWinner)
        {
            int tmp = rand.Next(40, 140);

            GameCreator.AllNumbers[GameCreator.CountNamedNumbers] = tmp;
            Console.WriteLine($"Player 1: {tmp}");
            GameCreator.CountNamedNumbers++;
            if (tmp == weight)
            {
                GameCreator.Victory(Player);
                isWinner = true;
            }
            else
            {
                isWinner = false;
            }
            return(tmp);
        }