Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone help me write this program, I'm so confused. Boggle is a word-finding game. 16 dice that are modified to show letters instead of

Can someone help me write this program, I'm so confused.

Boggle is a word-finding game. 16 dice that are modified to show letters instead of pips or numbers are randomly placed in a 4x4 grid by shaking the game board while a lid is held to it. Players then try to find words using the letters on the top face of the dice. You are to write a program that generates random Boggle boards and then lets the user enter words to see if they might be found in the board.

The program must:

Load the dice from a data file called BoggleDiceCaps.txt and place them in the board.

Ask the user to press a key to shake the board.

Shake the board by randomly choosing two dice from the board and swapping their location. After this swap, randomly choose which side of each of the two dice is the top face.

Display the board on the screen in a neatly-formatted way.

Repeat steps 3 and 4 at least 500 times.

Display the final board.

Ask the user to enter a word. (It doesnt have to be a real word)

Check to see if the letters for the entered word exist in the board. You do not need to determine if they are playable according to the rules of Boggle, just if all the letters in the word are in the board. For example, in the picture above, the letters for BATTER can be found, but not the letters for BATTERY. Another example: EE can be found, but not EEE.

Output the results of step 8. (found or not found)

Repeat steps 7 to 9 until the user enters a key value to quit searching for words.

Once the user quits searching for words, go back to step 2.

Note: This program is designed to have an infinite loop in it. It just generates boards until the user closes the window.

I have placed an executable version of this program on Moodle so you can download it and run it to see how the program should look. The input file is also there. When running the program file, make sure the input file is in the same folder or it wont work.

Specifications:

The dice must be stored in a two-dimensional array of strings.

Between shaking the dice, you must clear the screen so that the board stays at the top of the output screen. Use the clearScreen() function provided below to do this.

The letter Q always has a u along with it. So when the Q face shows up, you must output Qu to the screen.

When looking for a word in the board, you DO NOT have to worry about the Q having an extra u. Just check for the Q and ignore the extra u.

To press enter to continue use: getchar();

To get random numbers for choosing the dice to swap and for choosing which face is on top, use: srand(unsigned (time(NULL))); to seed the random number generator and (rand() % x) to get a number between 0 and (x 1) .

Part of your grade (20 points) will be based on how well you modularize your program. If you use only one function, the main() function, you will lose all 20 points. See the Basic Modularity Guidelines handout on Moodle.

Some sage advice: Do not start coding until you know exactly what you are doing. Implement this program one piece at a time. Start early and develop a complete plan.

What to turn in:

Only the .cpp file with your program in it. Name this file Program1.cpp or Boggle.cpp.

/*

clearScreen()

Chooses a system clear screen that hopefully works for whatever system is used.

Copied and modified from:

https://stackoverflow.com/questions/228617/how-do-i-clear-the-console-in-both-windows-and-linux-using-c

*/

void clearScreen()

{

#ifdef _WIN32

system("cls");

#else

// Assume POSIX

system("clear");

#endif

}

EDIT:

Here's the dice caps we are supposed to use:

LRYTTE VTHRWE EGHWNE SEOTIS ANAEEG IDSYTT OATTOW MTOICU AFPKFS XLDERI HCPOAS ENSIEU YLDEVR ZNRNHL OBBAOJ NMIQHU 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Ehs 2.0 Revolutionizing The Future Of Safety With Digital Technology

Authors: Tony Mudd

1st Edition

B0CN69B3HW, 979-8867463663

More Books

Students also viewed these Databases questions

Question

5. Identify three characteristics of the dialectical approach.

Answered: 1 week ago

Question

7. Identify six intercultural communication dialectics.

Answered: 1 week ago