/* Kamil Kaminski * NetID: kkamin8 * * CS340 * Project 3, Sliding Block Puzzles * * */ #include "main.h" int main(int argc, char *argv[]) { /* seed rand() */ srand((unsigned int ) time(NULL)); if (argc != 2) { cout << "usage: " << argv[0] << " " << endl; return -1; } cout << "\tSliding Block Puzzles" << endl << endl; Grid grid = loadGrid(argv); printGrid(grid); queue toCheck; queue checked; /* kickstart the queue */ possibleMoves(grid, toCheck); /* main algorithm */ while (!toCheck.empty()) { Grid popped = toCheck.front(); toCheck.pop(); if (checkSoln(popped)) { cout << "Solution: " << endl; printGrid(popped); cout << "Steps: " << endl; popped.printMoves(); break; } else possibleMoves(popped, toCheck); } cout << "\n\tBye!" << endl; return 0; }