GithubHelp home page GithubHelp logo

sudoku's Introduction

Sudoku Validator

Sudoku Validator is a command line java application that validates a sudoku which is given in a csv (.csv or .txt) file. In case of a valid Sudoku the validator returns 0 and non-zero for an invalid one.

Sudoku validation rules

A given Sudoku is valid if all of the following rules are fulfilled.

  1. Each row must contain the digits 1-9 without repetition
  2. Each column must contain the digits 1-9 without repetition.
  3. Each of the 9 3x3 sub-boxes of the grid must contain the digits 1-9 without repetition.
  4. The Sudoku board could be partially filled, where empty cells can be filled with an empty character (space) (or no-character).

Example of a valid Sudoku

 , , ,9,1,7, , ,8
 , ,5, , ,4, , ,2
 , , , , , ,4,9,
6,5, ,3, ,1, ,2,4
1,4, ,8, ,9, ,6,3
8,3, ,4, ,5, ,1,9
 ,7,8, , , , , ,
4, , ,5, , ,6, ,
5, , ,7,4,8, , ,

Example of an invalid Sudoku (includes duplicate in first row)

9, , ,9,1,7, , ,8
 , ,5, , ,4, , ,2
 , , , , , ,4,9,
6,5, ,3, ,1, ,2,4
1,4, ,8, ,9, ,6,3
8,3, ,4, ,5, ,1,9
 ,7,8, , , , , ,
4, , ,5, , ,6, ,
5, , ,7,4,8, , ,

Project Structure

Directory Description
./run Run script (validateSudoku.bat)
./src The source code.

How to compile

Sudoku Validator is a maven project and can be compiled by running the following:

mvn clean compile

How to build

Sudoku Validator is a maven project and can be built by running the following:

mvn clean package

By building the project we can find an executable jar file in ./target/sudoku-validator-***-.jar as well as the required libraries in ./target/libs/.

How to run the application

Sudoku validator can be ran in Windows OS by running from the run dir the following:

validateSudoku.bat givenSudoku.txt

How to generate the test-coverage report for the unit tests

In order to generate the test-coverage report you can run the following:

mvn clean test

The generated reports can be found in ./target/site/jacoco/index.html. eg. Test Coverage

Out of Scope

It is out of scope the check if a given sudoku is solvable or not. Solvable means that the given sudoku has one and only one solution.

sudoku's People

Contributors

stjook avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.