taleldayekh / sudoku-solver

0 stars 0 forks source link

CI codecov

Table of Contents

API

Sudoku Resource Overview

HTTP Method Description Resource Success Code Failure Code
POST Solve sudoku api/v1/sudoku/solve 200 400
POST Sudoku solution hint api/v1/sudoku/hint 200 400
POST Sudoku verify solution api/v1/sudoku/verify 200 400
GET Generate sudoku api/v1/sudoku/generate 200

Sudoku Resource Details

POST solve #### Request ```shell curl -X POST \ http://localhost:5000/api/v1/sudoku/solve \ -H "Content-Type: application/json" \ -d '{"sudoku": []}' ``` #### Success Responses ```shell {"data": []} ``` ```shell {"data": "Sudoku is unsolvable"} ``` #### Error Responses ```shell {"data": "Not a valid sudoku"} ``` ```shell {"error": "Invalid JSON key"} ```
POST hint #### Request ```shell curl -X POST \ http://localhost:5000/api/v1/sudoku/hint \ -H "Content-Type: application/json" \ -d '{"sudoku": []}' ``` #### Success Responses ```shell {"data": []} ``` ```shell {"data": "Sudoku is unsolvable"} ``` #### Error Responses ```shell {"data": "Not a valid sudoku"} ``` ```shell {"error": "Invalid JSON key"} ```
POST verify #### Request ```shell curl -X POST \ http://localhost:5000/api/v1/sudoku/verify \ -H "Content-Type: application/json" \ -d '{"sudoku": []}' ``` #### Success Responses ```shell {"data": bool} ``` #### Error Responses ```shell {"data": "Not a valid sudoku"} ``` ```shell {"error": "Invalid JSON key"} ```
GET generate #### Request ```shell curl http://localhost:5000/api/v1/sudoku/generate ``` #### Success Responses ```shell {"data": []} ```

Architecture

App

View

  1. View

    Views are the touching points for users, they receive user input and displays output. A View is considered "dumb" (presentational) and does not contain any application logic.

    When a user interacts with a View events are triggered and passed on to a ViewController. A View will then change its visual state based on the response from the ViewController.

    Views should only be used for displaying data and may contain related subviews.

  2. ViewController

    A ViewController controls a View and its subviews, i.e. SudokuBoardView with the subview SudokuCellView. The ViewController is smart and contains all View related logic. ViewControllers work as the "glue" between the application and what users see on the screen.

    The ViewControllers resides between the Views and the ViewModels.

    A View is never aware of any ViewModels. Events like user inputs are not passed directly from the View to a ViewModel, they get passed to a ViewController which in turn prepares the data and passes it on to the ViewModel.

    A ViewController can reference many different ViweModels.