Skip to content
This repository was archived by the owner on Jun 8, 2019. It is now read-only.

Conversation

@elubin
Copy link

@elubin elubin commented Oct 21, 2013

The reader parses the file and does some light validation.

The parser init parses the input into arrays of rows, columns and grids. The valid? checks for unique in those arrays.

➜ sudoku_validator git:(master) ruby SudokuValidator.rb valid_complete.sudoku
true
➜ sudoku_validator git:(master) ruby SudokuValidator.rb invalid_complete.sudoku
false
➜ sudoku_validator git:(master) ruby SudokuValidator.rb valid_incomplete.sudoku
true
➜ sudoku_validator git:(master) ruby SudokuValidator.rb invalid_incomplete.sudoku
false

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could potentially refactored this /^[1-9|+.\-\s]+$/ into a named method so it would be clearer.

@elubin
Copy link
Author

elubin commented Oct 24, 2013

thanks @gniquil. good call on the regex. i made the change.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants