コード例 #1
0
        //0-89
        public void GoToNextStep(int newNumber)
        {
            Printer.ClearScreen();
            State.UserNumbers.Add(newNumber);

            if (State.WinningNumbers.Contains(newNumber))
            {
                State.UserCredit++;
            }

            if (State.UserNumbers.Count == Constants.NumberOfTries)
            {
                var currentLuckyNumbers = State.UserNumbers.Count(userNr => State.WinningNumbers.Contains(userNr));

                if (currentLuckyNumbers == Constants.NumberOfTries)
                {
                    State.UserCredit *= 2;
                }
                Stage = GameStage.EndGame;
            }
            Printer.PrintGrid(State);

            if (State.UserNumbers.Count == Constants.NumberOfTries)
            {
                Printer.PrintScore(State.UserCredit);
            }
            Printer.PrintAvailableOptions(Stage);
        }
コード例 #2
0
        //show
        public void OpenOrNewSession()
        {
            if (Stage == GameStage.InGame || Stage == GameStage.EndGame)
            {
                InitGame();
            }

            Stage = State.UserNumbers.Count == Constants.NumberOfTries ? GameStage.EndGame : GameStage.InGame;
            Printer.ClearScreen();

            Printer.PrintGrid(State);
            if (Stage == GameStage.EndGame)
            {
                Printer.PrintScore(State.UserCredit);
            }

            Printer.PrintAvailableOptions(Stage);
        }