binary_puzzle_solver 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
| 
         @@ -0,0 +1,29 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'binary_puzzle_solver'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            filename = ARGV.shift
         
     | 
| 
      
 6 
     | 
    
         
            +
            board = Binary_Puzzle_Solver.gen_board_from_string_v1(IO.read(filename))
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            board.add_to_iters_quota(1_000_000_000);
         
     | 
| 
      
 9 
     | 
    
         
            +
            board.try_to_solve_using(
         
     | 
| 
      
 10 
     | 
    
         
            +
                :methods => [
         
     | 
| 
      
 11 
     | 
    
         
            +
                    :check_and_handle_sequences_in_row,
         
     | 
| 
      
 12 
     | 
    
         
            +
                    :check_and_handle_known_unknown_sameknown_in_row,
         
     | 
| 
      
 13 
     | 
    
         
            +
                    :check_and_handle_cells_of_one_value_in_row_were_all_found,
         
     | 
| 
      
 14 
     | 
    
         
            +
                    :check_exceeded_numbers_while_accounting_for_two_unknown_gaps,
         
     | 
| 
      
 15 
     | 
    
         
            +
                    :check_try_placing_last_of_certain_digit_in_row,
         
     | 
| 
      
 16 
     | 
    
         
            +
                ]
         
     | 
| 
      
 17 
     | 
    
         
            +
            );
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            puts "[Start Moves]"
         
     | 
| 
      
 20 
     | 
    
         
            +
            board.get_moves.each do |m|
         
     | 
| 
      
 21 
     | 
    
         
            +
                puts "Put #{m.val} in x=#{m.coord.x} y=#{m.coord.y} due to:"
         
     | 
| 
      
 22 
     | 
    
         
            +
                puts "    #{m.reason}"
         
     | 
| 
      
 23 
     | 
    
         
            +
                puts "    Based on #{m.dir}"
         
     | 
| 
      
 24 
     | 
    
         
            +
            end
         
     | 
| 
      
 25 
     | 
    
         
            +
            puts "[End Moves]"
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            puts "------------------------------"
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            puts board.as_string()
         
     | 
| 
         @@ -6,6 +6,7 @@ require "binary_puzzle_solver/version" 
     | 
|
| 
       6 
6 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       7 
7 
     | 
    
         
             
                s.name        = "binary_puzzle_solver"
         
     | 
| 
       8 
8 
     | 
    
         
             
                s.version     = Binary_Puzzle_Solver::VERSION
         
     | 
| 
      
 9 
     | 
    
         
            +
                s.executables << 'binary-puzzle-solve'
         
     | 
| 
       9 
10 
     | 
    
         
             
                s.platform    = Gem::Platform::RUBY
         
     | 
| 
       10 
11 
     | 
    
         
             
                s.authors     = ["Shlomi Fish"]
         
     | 
| 
       11 
12 
     | 
    
         
             
                s.email       = ["shlomif@cpan.org"]
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: binary_puzzle_solver
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.3
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -48,7 +48,8 @@ description: ! "This is a solver for instances of the so-called Binary\n      Pu 
     | 
|
| 
       48 
48 
     | 
    
         
             
              some games\n    "
         
     | 
| 
       49 
49 
     | 
    
         
             
            email:
         
     | 
| 
       50 
50 
     | 
    
         
             
            - shlomif@cpan.org
         
     | 
| 
       51 
     | 
    
         
            -
            executables: 
     | 
| 
      
 51 
     | 
    
         
            +
            executables:
         
     | 
| 
      
 52 
     | 
    
         
            +
            - binary-puzzle-solve
         
     | 
| 
       52 
53 
     | 
    
         
             
            extensions: []
         
     | 
| 
       53 
54 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       54 
55 
     | 
    
         
             
            files:
         
     | 
| 
         @@ -58,6 +59,7 @@ files: 
     | 
|
| 
       58 
59 
     | 
    
         
             
            - Makefile
         
     | 
| 
       59 
60 
     | 
    
         
             
            - README.md
         
     | 
| 
       60 
61 
     | 
    
         
             
            - Rakefile
         
     | 
| 
      
 62 
     | 
    
         
            +
            - bin/binary-puzzle-solve
         
     | 
| 
       61 
63 
     | 
    
         
             
            - binary_puzzle_solver.gemspec
         
     | 
| 
       62 
64 
     | 
    
         
             
            - lib/binary_puzzle_solver.rb
         
     | 
| 
       63 
65 
     | 
    
         
             
            - lib/binary_puzzle_solver/base.rb
         
     |