X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=grid5.c;fp=grid5.c;h=18c9b0b797c8705c8c53c32d8c9f230685d608f6;hb=4209ed5b071d81e28d7a9286599d33352be84c5e;hp=0000000000000000000000000000000000000000;hpb=76c92c2f9f062d3bc3cbbf57416fe6b23f1d114b;p=wordgame diff --git a/grid5.c b/grid5.c new file mode 100644 index 0000000..18c9b0b --- /dev/null +++ b/grid5.c @@ -0,0 +1,51 @@ +/* + * 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." + */ + +#include "grid.h" +#include "word-game.h" + +#include +#include + +#define GAME_LENGTH (3 * 60) +int +main (void) +{ + dict_t dict, solution; + grid_t grid; + struct timeval tv; + + gettimeofday (&tv, NULL); + srand (tv.tv_sec ^ tv.tv_usec); + + dict_init (&dict); + dict_add_words_from_file (&dict, "words.txt"); + + grid_init (&grid, 5); + + dict_init (&solution); + grid_solve (&grid, &dict, &solution); + + word_game_play (grid_string (&grid), + &dict, &solution, GAME_LENGTH); + + dict_fini (&solution); + dict_fini (&dict); + + return 0; +}