Git Product home page Git Product logo

sudokuvalidator's Introduction

Soduku Validator

CLI Application that takes a .txt file containing the solution to a 9x9 sudoku table.

Utilizes Semaphores and Java Threads to validate each row, column, and sub-grid concurrently.

How to Run

I provide two ways to run the program. I recommend Option#1 because it also deletes excess generated .class files. If you want to generated the .class files use Option#2.

Examples of usage will be provided below.

Use git clone to or download a zip of the project to get the files.

Options

Replace [fileName] with the name of the txt file that contains the solution

Option#1: sh run.sh [fileName]

Option#2: javac Reader.java && java Reader [fileName]

Example Usage

Example#1: sh run.sh wrongSolutionExample.txt

Example#2: javac Reader.java && java Reader correctSolutionExample.txt

Sample Input

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

Sample Outputs

Sample output for wrongSolutionExample.txt:

Thread 1, Row 1, Valid
Thread 2, Column 1, Valid
Thread 3, SubGrid R123-C123, Valid
Thread 2, Column 2, Valid
Thread 1, Row 2, Valid
Thread 2, Column 3, Valid
Thread 1, Row 3, Valid
Thread 3, SubGrid R123-C456, Valid
Thread 1, Row 4, Valid
Thread 2, Column 4, Valid
Thread 1, Row 5, Valid
Thread 3, SubGrid R123-C789, Valid
Thread 1, Row 6, Valid
Thread 2, Column 5, Invalid
Thread 1, Row 7, Valid
Thread 3, SubGrid R456-C123, Valid
Thread 1, Row 8, Valid
Thread 2, Column 6, Valid
Thread 1, Row 9, Invalid
Thread 3, SubGrid R456-C456, Valid
Thread 2, Column 7, Valid
Thread 3, SubGrid R456-C789, Valid
Thread 2, Column 8, Valid
Thread 3, SubGrid R789-C123, Valid
Thread 2, Column 9, Valid
Thread 3, SubGrid R789-C456, Invalid
Thread 3, SubGrid R789-C789, Valid

Sample output for correctSolutionExample.txt:

Thread 1, Row 1, Valid
Thread 3, SubGrid R123-C123, Valid
Thread 2, Column 1, Valid
Thread 3, SubGrid R123-C456, Valid
Thread 1, Row 2, Valid
Thread 2, Column 2, Valid
Thread 1, Row 3, Valid
Thread 2, Column 3, Valid
Thread 3, SubGrid R123-C789, Valid
Thread 2, Column 4, Valid
Thread 3, SubGrid R456-C123, Valid
Thread 1, Row 4, Valid
Thread 3, SubGrid R456-C456, Valid
Thread 2, Column 5, Valid
Thread 3, SubGrid R456-C789, Valid
Thread 2, Column 6, Valid
Thread 1, Row 5, Valid
Thread 2, Column 7, Valid
Thread 3, SubGrid R789-C123, Valid
Thread 2, Column 8, Valid
Thread 1, Row 6, Valid
Thread 2, Column 9, Valid
Thread 3, SubGrid R789-C456, Valid
Thread 1, Row 7, Valid
Thread 3, SubGrid R789-C789, Valid
Thread 1, Row 8, Valid
Thread 1, Row 9, Valid

sudokuvalidator's People

Contributors

baboyachoch avatar

Stargazers

 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.