Giter Site home page Giter Site logo

sudoku's Introduction

pd2-sudoku

Input / Output

Generate

  1. Output sudoku problem when execution

Example

$ ./generate
3 0 2 0 0 5 6 9 0
0 4 0 0 9 6 0 3 0
0 5 0 0 0 8 0 0 0
1 9 0 0 8 0 7 0 3
0 0 0 0 0 0 0 0 0
5 0 7 0 3 0 0 6 1
0 0 0 8 0 0 0 2 0
0 8 0 9 6 0 0 7 0
0 6 5 7 0 0 3 0 9

Transform

  1. input sudoku problem
  2. input transform command
  3. output transformed sudoku

Command Format

  1. 0 // quit
  2. 1 x y // changeNum
  3. 2 x y // changeRow
  4. 3 x y // changeCol
  5. 4 x // clockwise rotate 90 degree x times
  6. 5 x // 0 is up-down flip, 1 is left-right flip

Example

$ ./transform
## input problem
3 0 2 0 0 5 6 9 0
0 4 0 0 9 6 0 3 0
0 5 0 0 0 8 0 0 0
1 9 0 0 8 0 7 0 3
0 0 0 0 0 0 0 0 0
5 0 7 0 3 0 0 6 1
0 0 0 8 0 0 0 2 0
0 8 0 9 6 0 0 7 0
0 6 5 7 0 0 3 0 9
## command
1 1 9
2 0 1
3 1 2
4 1
5 1
0
## output
9 0 5 3 0 0 0 0 0
1 0 0 0 4 5 0 8 6
0 0 7 2 0 0 0 0 5
7 0 0 6 0 0 0 0 3
0 0 6 1 3 0 2 7 0
3 0 9 0 0 0 0 0 1
0 0 0 0 0 0 8 1 7
8 0 3 0 1 0 0 6 0
0 0 0 5 6 8 0 0 0

Solve

  1. input sudoku problem
  2. output solved sudoku

Output format

## Unsolvable
0
## Solved

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

## Multiple answer

2

Example

$ ./solve

## input

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

## output

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

SUDOKUTRY

sudoku's People

Contributors

ypctw avatar

Stargazers

 avatar

Watchers

James Cloos avatar  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.