#include #include "stack.h" #include "queue.h" #include "queens.h" int main (int argc, char *argv[]) { BOARDPTR board; NODEPTR open, tail, first; int moves=0; int search; if ( argc == 2 ) { search = atoi (argv[1]); } else { search = SEARCH; } open = NULL; tail = NULL; first = CreateNode (InitBoard ()); Enqueue (&open, &tail, first); if ( search == DFS ) { printf ("Starting depth-first search...\n"); } else if ( search == BFS ) { printf ("Starting breadth-first search...\n"); } else { fprintf (stderr, "Unknown search method %d -- exiting!\n", search); exit (-1); } board = Search (&open, &tail, &moves, search); if ( board ) { printf ("Solution found for %d x %d board in %d moves\n", ROWS, ROWS, moves); PrintBoard (board); } else { printf ("No solution found for %d x %d board in %d moves\n", ROWS, ROWS, moves); } return (0); }