Пример #1
0
        private void CroupierOpen()
        {
            int   indexSelectedDoor = -1;
            Prize prizeSelectedDoor = player.SelectedDoor.Prize;

            for (int i = 0; i < Doors.Length; i++)
            {
                if (player.SelectedDoor == Doors[i])
                {
                    indexSelectedDoor = i;
                    break;
                }
            }

            if (prizeSelectedDoor == Prize.Goat)
            {
                for (int i = 0; i < Doors.Length; i++)
                {
                    if (i != indexSelectedDoor && Doors[i].Prize != Prize.Car)
                    {
                        croupier.OpenTheDoor(Doors[i]);
                        break;
                    }
                }
            }
            else
            {
                for (int i = 0; i < Doors.Length; i++)
                {
                    if (i != indexSelectedDoor)
                    {
                        croupier.OpenTheDoor(Doors[i]);
                        break;
                    }
                }
            }
        }