/* * Function: main * ----------------- * Serves as entry point of program. Takes in all user inputs to determine specific boggle configuration. * Then, it gives the user a chance to find words in the boggleBoard. Then, the computer takes over * to find any remaining words. Finally, gives user option to play another round. * *@return 0 if program completed successfully. */ int main() { Randomize(); //initializes random constructor SetWindowSize(8, 5); InitGraphics(); Welcome(); GiveInstructions(); Lexicon wordList("lexicon.dat"); //generates list of all possible words while (true) { Lexicon usedWords; //generates a list that stores all words found by the player and computer InitGraphics(); SoundFeature(); int boardDimension = BoggleBoardSize(); DrawBoard(boardDimension, boardDimension); Grid<char> boggleBoard(boardDimension, boardDimension); if (!UserBoardConfiguration()) { InitializeRandomBoard(boggleBoard); //if user chooses not to specify board configuration, a random one is generated } else { string diceConfig = GetDiceConfiguration(boardDimension); SetDiceConfiguration(boggleBoard, diceConfig); } DrawBoggleBoard(boggleBoard); Grid<bool> usedDice(boggleBoard.numRows(), boggleBoard.numCols()); CreateMarker(usedDice); InputGuesses(boggleBoard, wordList, usedWords, usedDice); //player's turn FindRemainingWords(boggleBoard, wordList, usedWords, usedDice); //computer's turn PlayNamedSound("thats pathetic.wav"); //assumes the player will always lose to the computer if (!GameContinue()) break; } return 0; }
int main(int argc, const char * argv[]) { clock_t startTime = clock(); Dictionary dict; Board boggleBoard(dict); boggleBoard.solve(); clock_t endTime = clock(); double timeToSolve = double(endTime - startTime) / CLOCKS_PER_SEC; std::cout << timeToSolve << std::endl; std::cout << boggleBoard.GetFoundWordsSize() << std::endl; return 0; }