private void RetrieveGameSession() {
     _currentGame = (SudokuGame)Session["game"];
     if (_currentGame == null) {
         NewGameSession();
         _currentGame = (SudokuGame)Session["game"];
     }
 }
Ejemplo n.º 2
0
        public void TestSetValue()
        {
            SudokuGame game = new SudokuGame();

            game.NewGame();

            /*Assert.AreEqual(true, game.SetValue(new Position()
            {
                X = 1,
                Y = 1,
                Value = 5
            }));*/


            while (!game.IsCompleted())
            {
                game.SetValue(game.GetHint());
            }

            Assert.AreEqual(true, game.IsValid());

            int count = 0;
            foreach (Position p in game.GetBoard())
            {
                if (p.Value > 0)
                {
                    count++;
                }
            }

            Assert.AreEqual(81, count);
        }
        public MainViewModel() {
            _sudoku = new SudokuGame();

            NewGame();

            #region Commands

            NewGameCommand = new RelayCommand(NewGame, CanNewGame);
            CheckCommand = new RelayCommand(CheckGame, CanCheckGame);
            CheatCommand = new RelayCommand(CheatGame, CanCheatGame);

            #endregion
        }
 private void NewGameSession() {
     var game = new SudokuGame();
     game.NewGame();
     Session["game"] = game;
 }
Ejemplo n.º 5
0
 public Location(SudokuGame game, Position position)
 {
     _game = game;
     _position = position;
 }