Beispiel #1
0
 //end
 public void EndSession()
 {
     Stage = GameStage.Started;
     Printer.ClearScreen();
     Printer.PrintScore(State.UserCredit);
     Printer.PrintAvailableOptions(Stage);
 }
Beispiel #2
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);
        }
Beispiel #3
0
 //new
 public void NewGame()
 {
     State = new State();
     Stage = GameStage.Started;
     InitGame();
     Printer.ClearScreen();
     Printer.PrintAvailableOptions(Stage);
 }
Beispiel #4
0
 //continue
 public void ContinueGame()
 {
     if (Persister.HasSaveState())
     {
         State = Persister.Load();
         Stage = GameStage.Started;
     }
     else
     {
         Printer.PrintSaveNotExist();
     }
     Printer.ClearScreen();
     Printer.PrintAvailableOptions(Stage);
 }
Beispiel #5
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);
        }