Skip to content

A command line Sudoku game written in plain Java 11

Notifications You must be signed in to change notification settings

borisskert/java-sudoku

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to
 .----------------.  .----------------.  .----------------.  .----------------.  .----------------.  .----------------. 
| .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. |
| |    _______   | || | _____  _____ | || |  ________    | || |     ____     | || |  ___  ____   | || | _____  _____ | |
| |   /  ___  |  | || ||_   _||_   _|| || | |_   ___ `.  | || |   .'    `.   | || | |_  ||_  _|  | || ||_   _||_   _|| |
| |  |  (__ \_|  | || |  | |    | |  | || |   | |   `. \ | || |  /  .--.  \  | || |   | |_/ /    | || |  | |    | |  | |
| |   '.___`-.   | || |  | '    ' |  | || |   | |    | | | || |  | |    | |  | || |   |  __'.    | || |  | '    ' |  | |
| |  |`\____) |  | || |   \ `--' /   | || |  _| |___.' / | || |  \  `--'  /  | || |  _| |  \ \_  | || |   \ `--' /   | |
| |  |_______.'  | || |    `.__.'    | || | |________.'  | || |   `.____.'   | || | |____||____| | || |    `.__.'    | |
| |              | || |              | || |              | || |              | || |              | || |              | |
| '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' |
 '----------------'  '----------------'  '----------------'  '----------------'  '----------------'  '----------------' 

Build

With java and maven installed

Build

mvn package

Run console game

java -Dfile.encoding=UTF-8 -jar target/sudoku.jar

With Docker installed

Build

docker build -t borisskert/sudoku .

Run console game

docker run -it --rm borisskert/sudoku

Game looks like:

Width: 3
Height: 3
Level (1=easy, 2=medium, 3=hard): 2
Creating puzzle...
╔═╤═╤═╦═╤═╤═╦═╤═╤═╗
║ │ │ ║ │ │7║ │ │ ║
╟─┼─┼─╫─┼─┼─╫─┼─┼─╢
║ │ │ ║ │ │ ║ │ │ ║
╟─┼─┼─╫─┼─┼─╫─┼─┼─╢
║ │ │ ║ │2│1║ │ │6║
╠═╪═╪═╬═╪═╪═╬═╪═╪═╣
║ │8│ ║ │ │2║ │5│ ║
╟─┼─┼─╫─┼─┼─╫─┼─┼─╢
║ │ │ ║ │ │8║3│ │ ║
╟─┼─┼─╫─┼─┼─╫─┼─┼─╢
║ │ │ ║7│ │ ║ │ │ ║
╠═╪═╪═╬═╪═╪═╬═╪═╪═╣
║ │ │2║ │4│ ║ │6│8║
╟─┼─┼─╫─┼─┼─╫─┼─┼─╢
║7│ │8║ │1│9║ │ │5║
╟─┼─┼─╫─┼─┼─╫─┼─┼─╢
║ │ │ ║ │7│ ║ │ │ ║
╚═╧═╧═╩═╧═╧═╩═╧═╧═╝

Columns: right to left, 1 to 9
Lines: top to bottom, 1 to 9
Values: 1 to 9
Type in 'SOLVE' to solve the puzzle
Column: _
Line: _
Value: _