From: Ian Jackson Date: Fri, 7 Mar 2014 13:22:08 +0000 (+0000) Subject: wip X-Git-Tag: v1~24 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=matchsticks-search.git;a=commitdiff_plain;h=8f790b20274793eb7de88fa16aac9eb5beed32c7 wip --- 8f790b20274793eb7de88fa16aac9eb5beed32c7 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b25c15b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*~ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..af97bd2 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +CFLAGS += -Wall -Wwrite-strings -Wstrict-prototypes +LC_CTYPE=C + +all: main diff --git a/main.c b/main.c new file mode 100644 index 0000000..0c694c8 --- /dev/null +++ b/main.c @@ -0,0 +1,58 @@ + +typedef uint32_t AdjWord; +#define PRADJ PRIx32 + +static int n, m; +static AdjWord adjmatrix[n]; +static AdjWord adjall; + +static double best; +static AdjWord adjmatrix_best[n]; + +static void prep(void) { + adjall = ~((~(AdjWord)0) << m); +} + +static int count_set_adj_bits(AdjWord w) { + for (int j=0, total=0; j n) { + optimise(); + return; + } + for (adjmatrix[i] = min; + ; + adjmatrix[i]++) { + iterate_recurse(i+1, adjmatrix[i]); + } +} + +static void iterate(void) { + iterate_recurse(0, 1); +} + +int main(int argc, char **argv) { + n = atoi(argv[1]); + m = atoi(argv[2]); + prep(); + iterate(); + if (ferror(stdout) || fclose(stdout)) { perror("stdout"); exit(-1); } + return 0; +}