/*
* 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);
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);