sudoku_gem 1.0.0 → 1.0.1
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.
- checksums.yaml +4 -4
- data/ext/sudoku_gem/sudoku.cpp +8 -2
- data/ext/sudoku_gem/sudoku_gem.c +2 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6cccc05929af1842c549d0f9300115665ecafffe
|
4
|
+
data.tar.gz: 522fa69b45d326630ebfeb2d6dbeb239862aab01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa0336157ca9508b97b41d32bdf139f07632f6fe86e727367a62e67fb30448a771a6df2336ef8ded1e8e111bcf6f6d2b895d6c4515fa016f27c160954413c7e5
|
7
|
+
data.tar.gz: 877a8aa68189d466919de02f292c1779366d244b1dac7612d8258348f99c8a2bdfe33d4c476f899233b8bebd44d30f8f0d7ecce5aaa0fb46a4a1cfd7fc6ad0d7
|
data/ext/sudoku_gem/sudoku.cpp
CHANGED
@@ -103,7 +103,10 @@ bool Sudoku::parse_puzzle(std::istream& f)
|
|
103
103
|
this->grid.reset(n);
|
104
104
|
|
105
105
|
//put in the first row
|
106
|
-
this->insert_row(tokens, 0)
|
106
|
+
if (!this->insert_row(tokens, 0))
|
107
|
+
{
|
108
|
+
return false;
|
109
|
+
}
|
107
110
|
|
108
111
|
//read n-1 lines
|
109
112
|
for (std::size_t y = 1; y < n; y++)
|
@@ -119,7 +122,10 @@ bool Sudoku::parse_puzzle(std::istream& f)
|
|
119
122
|
}
|
120
123
|
|
121
124
|
//insert that row
|
122
|
-
this->insert_row(tokens, y)
|
125
|
+
if (!this->insert_row(tokens, y))
|
126
|
+
{
|
127
|
+
return false;
|
128
|
+
}
|
123
129
|
}
|
124
130
|
|
125
131
|
return true;
|
data/ext/sudoku_gem/sudoku_gem.c
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
#include <ruby.h>
|
2
2
|
#include <string>
|
3
3
|
#include "sudoku.h"
|
4
|
-
#include <iostream>
|
5
4
|
|
6
5
|
typedef VALUE (* ruby_method)(...);
|
7
6
|
|
@@ -18,9 +17,9 @@ VALUE sudoku_gem_solve(VALUE self, VALUE rb_puzzle)
|
|
18
17
|
|
19
18
|
sudoku.solve_colorability_style();
|
20
19
|
|
21
|
-
std::string
|
20
|
+
std::string cpp_solution = sudoku.to_s();
|
22
21
|
|
23
|
-
return rb_str_new(
|
22
|
+
return rb_str_new(cpp_solution.c_str(), cpp_solution.length());
|
24
23
|
}
|
25
24
|
|
26
25
|
extern "C"
|