The purpose of this project is to get a little practice with Ruby. The idea is that this will serve as a sudoku solver.
To run the project locally, install the dependencies using Bundler, then run with.
bundle install
bundle exec ruby lib/sudoku/run_local.rbThis section will describe the algorithm used to solve the puzzels. The basic idea is this.
- Find the possible options for each empty space
- Examine space-by-space for places with:
- Only one possibility
- Only space in the row with a possibility
- Only space in the column with a possibility
- Only space in the block with a possibility
This section will describe how to interface with the project. Ideally, I will include a web/HTTP api (using something like Sinatra), but that may be after the core of the application.
When the application starts, it will request the path to a file that contains a puzzle. The puzzle file should be nine lines long. Each line contains a space seperated list of entries. Each entry is either a number if given in the puzzle or a dash to indicate the space is blank.
- 3 8 2 - - - 4 5
- 1 - 6 - 5 - - -
5 - 7 - 8 - - - -
3 - 1 - 6 2 - 7 -
9 - - 5 - 7 - - 4
- 4 - 8 3 - 6 - 2
- - - - 2 - 3 - 8
- - - 9 - 3 - 2 -
2 7 - - - 8 4 9 -There is a test suite written with rspec. Run it with,
bundle exec rspec ./spec/bundle exec rubocop -D