diff options
Diffstat (limited to 'auxiliary/combi-test.c')
| -rw-r--r-- | auxiliary/combi-test.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/auxiliary/combi-test.c b/auxiliary/combi-test.c new file mode 100644 index 0000000..3db46e3 --- /dev/null +++ b/auxiliary/combi-test.c @@ -0,0 +1,25 @@ +#include <stdio.h> +#include "puzzles.h" + +int main(int argc, char *argv[]) +{ + combi_ctx *c; + int i, r, n; + + if (argc < 3) { + fprintf(stderr, "Usage: combi R N\n"); + exit(1); + } + + r = atoi(argv[1]); n = atoi(argv[2]); + c = new_combi(r, n); + printf("combi %d of %d, %d elements.\n", c->r, c->n, c->total); + + while (next_combi(c)) { + for (i = 0; i < c->r; i++) { + printf("%d ", c->a[i]); + } + printf("\n"); + } + free_combi(c); +} |