]> git.cworth.org Git - wordgame/blobdiff - grid4.c
Increase the window size a bit
[wordgame] / grid4.c
diff --git a/grid4.c b/grid4.c
index 96cb5e387283d651eedf1da4440ab0fd706a3fd5..9e686834fa5d29a8555b0c109e96ca51fcc20852 100644 (file)
--- a/grid4.c
+++ b/grid4.c
@@ -1,7 +1,7 @@
 /*
  * Copyright © 2006 Carl Worth
  *
- * This program is free software; you can redistribute it and\/or modify
+ * 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.
 #include "grid.h"
 #include "word-game.h"
 
+#include <string.h>
 #include <sys/time.h>
 #include <time.h>
 
 #define GAME_LENGTH (3 * 60)
 int
-main (void)
+main (int argc, char *argv[])
 {
     dict_t dict, solution;
     grid_t grid;
     struct timeval tv;
+    const char *letters = NULL;
+
+    if (argc > 1) {
+       if (argc == 2) {
+           letters = argv[1];
+       } else {
+           fprintf (stderr, "Usage: %s [letters]\n", argv[0]);
+           fprintf (stderr, "Uses the given 16 letters or else a random grid.\n");
+           return 1;
+       }
+    }
 
     gettimeofday (&tv, NULL);
     srand (tv.tv_sec ^ tv.tv_usec);
@@ -36,7 +48,9 @@ main (void)
     dict_init (&dict);
     dict_add_words_from_file (&dict, "words.txt");
 
-    grid_init (&grid);
+    grid_init (&grid, 4);
+    if (letters)
+       grid_set_letters (&grid, letters);
 
     dict_init (&solution);
     grid_solve (&grid, &dict, &solution);