lib/sudoku_builder.rb in sudoku_builder-0.1.3 vs lib/sudoku_builder.rb in sudoku_builder-1.1.0

- old
+ new

@@ -1,11 +1,30 @@ -require File.expand_path(File.join(File.dirname(__FILE__), 'sudoku_builder/sudoku')) -require File.expand_path(File.join(File.dirname(__FILE__), 'sudoku_builder/builder')) -require File.expand_path(File.join(File.dirname(__FILE__), 'sudoku_builder/solver' )) -require File.expand_path(File.join(File.dirname(__FILE__), 'sudoku_builder/version')) +require "sudoku_builder/version" +require "sudoku_builder/builder" +require "sudoku_builder/presenter" +require "sudoku_builder/tools" +require "sudoku_builder/values" +require "sudoku_builder/errors" +require "sudoku_builder/solver" -module SudokuBuilder - extend self - def new - Solver.new.create +class SudokuBuilder + attr_reader :tot, :res + + def initialize + @sud = blank + @used = blank + @loc = [0,0,0] ; @tot = 0 ; @res = 0 + end + + def self.create + sudoku = SudokuBuilder.new + sudoku.build + sudoku + end + + def self.solve(puzzle) + sudoku = SudokuBuilder.new + sudoku.parse_for_solve(puzzle) + sudoku.solve + sudoku end end