]> git.cworth.org Git - wordgame/blobdiff - grid.h
Split grid into main program in grid4.c and library functions in grid.c
[wordgame] / grid.h
diff --git a/grid.h b/grid.h
new file mode 100644 (file)
index 0000000..3d200c7
--- /dev/null
+++ b/grid.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright © 2006 Carl Worth
+ *
+ * This program is free software; you can redistribute it and\/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA."
+ */
+
+#ifndef _GRID_H_
+#define _GRID_H_
+
+#include "dict.h"
+
+/* (  3 chars per cell
+ *  x 4 cells per row
+ *  + 1 newline per row
+ * ) x 4 rows per grid
+ *   + 1 terminator character
+ * = 53
+ */
+#define GRID_STRING_MAX 53
+
+typedef struct _grid {
+    char letters[4][4];
+    char string[GRID_STRING_MAX];
+
+    /* Private, transient state used by enumerate */
+    dict_t *results;
+} grid_t;
+
+void
+grid_init (grid_t *grid);
+
+char *
+grid_string (grid_t *grid);
+
+void
+grid_solve (grid_t *grid, dict_t *dict, dict_t *solution);
+
+#endif /* _GRID_H_ */