Exemplo n.º 1
0
        public JsonResult SolveSudoku(int?[,] input)
        {
            try
            {
                if (null != input)
                {
                    var solvedSudoku = SudokuService.GetSolvedSudoku(input);
                    return(new JsonResult(solvedSudoku));
                }

                return(new JsonResult("no data was provided"));
            }
            catch (Exception e)
            {
                // Log the exception using any kind of logger
                return(new JsonResult("please enter correct data"));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Inicializa una nueva instancia de la clase <see cref="MainViewModel"/>
        /// </summary>
        /// <param name="navigationService">El servicio de navegación</param>
        /// <param name="sudokuService">El servicio de la API REST de Sudokus</param>
        /// <param name="messagingService">El servicio de mensajería</param>
        public MainViewModel(
            INavigationService navigationService,
            SudokuService sudokuService,
            MessagingService messagingService)
        {
            this.navigationService = navigationService;
            this.sudokuService     = sudokuService;
            this.messagingService  = messagingService;

            NewGameCommand         = new RelayCommand(NewGame, () => PlayingGame && !Thinking);
            PlayGameCommand        = new RelayCommand(PlayGame, () => !PlayingGame && !Thinking);
            VerifyValidGameCommand = new RelayCommand(VerifyValidGame, () => PlayingGame && !Thinking);
            ShowHelpCommand        = new RelayCommand(ShowHelp);

            cells = new Cell[9][];
            for (int row = 0; row < 9; row++)
            {
                cells[row] = new Cell[9];
                for (int column = 0; column < 9; column++)
                {
                    cells[row][column] = new Cell();
                }
            }
        }
Exemplo n.º 3
0
 public void Setup()
 {
     _service = new SudokuService();
 }
Exemplo n.º 4
0
 public HomeController(SudokuService sudokuService)
 {
     this.sudokuService = sudokuService;
 }
Exemplo n.º 5
0
 public IndexModel(SudokuService sudokuService)
 {
     sudoku = sudokuService;
 }
Exemplo n.º 6
0
        /// <summary>
        /// Inicializa una nueva instancia de la clase <see cref="MainViewModel"/>
        /// </summary>
        /// <param name="navigationService">El servicio de navegación</param>
        /// <param name="sudokuService">El servicio de la API REST de Sudokus</param>
        /// <param name="messagingService">El servicio de mensajería</param>
        public MainViewModel(
            INavigationService navigationService,
            SudokuService sudokuService,
            MessagingService messagingService)
        {
            this.navigationService = navigationService;
            this.sudokuService = sudokuService;
            this.messagingService = messagingService;

            NewGameCommand = new RelayCommand(NewGame, () => PlayingGame && !Thinking);
            PlayGameCommand = new RelayCommand(PlayGame, () => !PlayingGame && !Thinking);
            VerifyValidGameCommand = new RelayCommand(VerifyValidGame, () => PlayingGame && !Thinking);
            ShowHelpCommand = new RelayCommand(ShowHelp);

            cells = new Cell[9][];
            for (int row = 0; row < 9; row++)
            {
                cells[row] = new Cell[9];
                for (int column = 0; column < 9; column++)
                {
                    cells[row][column] = new Cell();
                }
            }
        }