X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/puzzles/blobdiff_plain/821ab2c68e12d85d6bb2ed8b0d48c846a65d06a0..444203b4c3de7b9a8c51fc940927c6f8352cd898:/puzzles.h diff --git a/puzzles.h b/puzzles.h index ebe6839..a962bc3 100644 --- a/puzzles.h +++ b/puzzles.h @@ -324,6 +324,20 @@ void ps_free(psdata *ps); drawing *ps_drawing_api(psdata *ps); /* + * combi.c: provides a structure and functions for iterating over + * combinations (i.e. choosing r things out of n). + */ +typedef struct _combi_ctx { + int r, n, nleft, total; + int *a; +} combi_ctx; + +combi_ctx *new_combi(int r, int n); +void reset_combi(combi_ctx *combi); +combi_ctx *next_combi(combi_ctx *combi); /* returns NULL for end */ +void free_combi(combi_ctx *combi); + +/* * Data structure containing the function calls and data specific * to a particular game. This is enclosed in a data structure so * that a particular platform can choose, if it wishes, to compile