chiark
/
gitweb
/
~ianmdlvl
/
matchsticks-search.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Python code to compute upper bounds on the solution.
[matchsticks-search.git]
/
main.c
diff --git
a/main.c
b/main.c
index 8259c35a968bb1525670e413f20281d9b38b49f1..3ee58c59760729eba27ae8b88123caa59d9062b0 100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-666,7
+666,7
@@
static void iterate_recurse(int i, AdjWord min) {
if (adjmatrix[i] & jbit)
weight[j]++;
for (int j = 0; j < m; j++)
if (adjmatrix[i] & jbit)
weight[j]++;
for (int j = 0; j < m; j++)
- if (weight[j] >
=
n_max_frags)
+ if (weight[j] > n_max_frags)
goto takeout;
iterate_recurse(i+1, adjmatrix[i]);
goto takeout;
iterate_recurse(i+1, adjmatrix[i]);
@@
-733,10
+733,11
@@
static void report(void) {
int main(int argc, char **argv) {
int opt;
int main(int argc, char **argv) {
int opt;
+ double best_to_set = -1.0; /* means 'don't' */
while ((opt = getopt(argc,argv,"j:b:")) >= 0) {
switch (opt) {
case 'j': ncpus = atoi(optarg); break;
while ((opt = getopt(argc,argv,"j:b:")) >= 0) {
switch (opt) {
case 'j': ncpus = atoi(optarg); break;
- case 'b':
set_best(atof(optarg)
); break;
+ case 'b':
best_to_set = atof(optarg
); break;
case '+': assert(!"bad option");
default: abort();
}
case '+': assert(!"bad option");
default: abort();
}
@@
-747,6
+748,7
@@
int main(int argc, char **argv) {
n = atoi(argv[1]);
m = atoi(argv[2]);
assert(n > m);
n = atoi(argv[1]);
m = atoi(argv[2]);
assert(n > m);
+ if (best_to_set > 0) set_best(best_to_set);
prep();
prep();