Esempio n. 1
0
        public void StartGame()
        {
            _view.SetField(_model.GetField());
            _view.ShowRules();
            _view.PrintField();
            _winner = Winner.None;
            while (_winner == Winner.None)
            {
                int[]     steps  = _view.GetSteps();
                GameState result = MakeStep(steps[0], steps[1]);
                if (result == GameState.WrongSmallField)
                {
                    _view.WrongFieldMessage();
                    continue;
                }
                if (result == GameState.BusyCell)
                {
                    _view.BusyCellMessage();
                    continue;
                }
                if (result == GameState.FullField)
                {
                    _view.WrongFieldMessage();
                    continue;
                }

                if (result == GameState.WinSmallField || result == GameState.WinGame)
                {
                    _view.SetLittleWinner(!_xStep, _littlePoint);                    // not _xStep cause its current player but we need previous there!!
                }
                _view.SetField(_model.GetField());
                _view.PrintField();
                if (result == GameState.GameOver)
                {
                    _view.Lose();
                    break;
                }
                if (result == GameState.WinGame)
                {
                    _view.Win(!_xStep);
                    break;
                }
            }
        }