Add initial classes and a couple of tests for Board

This commit is contained in:
Alberto Venturini 2019-10-28 07:14:02 +02:00
commit 895a9dd01b
15 changed files with 160 additions and 0 deletions

29
src/board.cr Normal file
View file

@ -0,0 +1,29 @@
module Sudoku
class Board
alias Value = Nil | Int8
enum State
Valid
Invalid
end
getter grid
def initialize(@width : Int8, @height : Int8)
@grid = Array(Value).new(@width * @height, nil)
end
def put(value : Value, x, y)
@grid[y * @width + x] = value
end
def get(x, y)
@grid[y * @width + x]
end
end
end

7
src/parser.cr Normal file
View file

@ -0,0 +1,7 @@
module Sudoku
# Parse a sudoku board from a string. Return a board.
class Parser
def self.parse(board_str)
end
end
end

7
src/position.cr Normal file
View file

@ -0,0 +1,7 @@
module Sudoku
struct Position
end
end

6
src/solver.cr Normal file
View file

@ -0,0 +1,6 @@
module Sudoku
class Solver
def self.solve(board)
end
end
end

7
src/sudoku.cr Normal file
View file

@ -0,0 +1,7 @@
# TODO: Write documentation for `Sudoku`
require "./*"
module Sudoku
VERSION = "0.1.0"
end