Example #1
0
        private DeckOfCards dealARound(DeckOfCards deckOfCards)
        {
            int index = 0;

            index++;
            NormalRound normalRound = new NormalRound();

            yield return(deckOfCards.Player1Hand[index]);
        }
Example #2
0
        private static GameRounds InputGameRounds(MyDBContext context)
        {
            GameRounds gameRounds;

            Games games = findGame(context);

            Console.Write("What round number are you at?: ");
            int roundNum = Convert.ToInt32(Console.ReadLine());

            Console.Write("What type of round are you playing (sole/normal): ");
            string round = Console.ReadLine();

            Console.Write("Is the round started (yes/no): ");
            string yesNo   = Console.ReadLine();
            bool   started = YesNo(yesNo);

            Console.Write("Is the round ended (yes/no): ");
            string E_yesNo = Console.ReadLine();
            bool   ended   = YesNo(E_yesNo);


            if (round == "sole")
            {
                //Add Type: SoleRound
                Console.Write("What solo type is this?: ");
                string    soloType  = Console.ReadLine();
                SoleRound soleRound = new SoleRound()
                {
                    SoloType = soloType
                };
                context.SoleRound.Add(soleRound);
                gameRounds = new GameRounds()
                {
                    Types    = soleRound,
                    RoundNum = roundNum,
                    Started  = started,
                    Ended    = ended,
                    Games    = games,
                };
                //Add SoleRoundWinner
                Console.WriteLine("How many sole round winners are there?");
                int number = Convert.ToInt32(Console.ReadLine());

                gameRounds.SoleRoundWinnerList = new List <SoleRoundWinner>();
                for (int i = 0; i < number; i++)
                {
                    Console.Write($"What is the trick for winner {i + 1}?: ");
                    int             trick           = Convert.ToInt32(Console.ReadLine());
                    SoleRoundWinner soleRoundWinner = new SoleRoundWinner()
                    {
                        GameRound = gameRounds,
                        Tricks    = trick
                    };
                    context.SoleRoundWinner.Add(soleRoundWinner);
                }
            }
            else
            {
                //Add Type: NormalRound
                Console.Write("What is the trick?: ");
                int trick = Convert.ToInt32(Console.ReadLine());

                Console.Write("What is the bid attachment?:");
                int bidAttachment = Convert.ToInt32(Console.ReadLine());

                Console.Write("What is the bid tricks?:");
                int bidTricks = Convert.ToInt32(Console.ReadLine());

                NormalRound normalRound = new NormalRound()
                {
                    Tricks        = trick,
                    BidAttachment = bidAttachment,
                    BitTricks     = bidTricks
                };
                context.NormalRound.Add(normalRound);

                gameRounds = new GameRounds()
                {
                    Types    = normalRound,
                    RoundNum = roundNum,
                    Started  = started,
                    Ended    = ended,
                    Games    = games,
                };
            }
            //Add GameRoundPlayers
            Console.WriteLine("Add points your game round players: ");
            gameRounds.GameRoundPlayersList = new List <GameRoundPlayers>();
            for (int i = 0; i < 4; i++)
            {
                Console.Write($"Player {i + 1}'s points: ");
                int points = Convert.ToInt32(Console.ReadLine());
                GameRoundPlayers gameRoundPlayers = new GameRoundPlayers()
                {
                    Points     = points,
                    GameRounds = gameRounds
                };
                context.GameRoundPlayers.Add(gameRoundPlayers);
            }

            return(gameRounds);
        }