Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write pseudocode for the Word Jumble game from Chapter 3. From the textbook \"Be

ID: 3669546 • Letter: W

Question

Write pseudocode for the Word Jumble game from Chapter 3.
From the textbook "Beginning C++ Through Game Programming" by Michael Dawson Write pseudocode for the Word Jumble game from Chapter 3.
From the textbook "Beginning C++ Through Game Programming" by Michael Dawson
From the textbook "Beginning C++ Through Game Programming" by Michael Dawson

Explanation / Answer

#include "JumblePuzzle.h" using namespace std; BadJumbleException::BadJumbleException(const string& msg) { message = msg + ' '; } string BadJumbleException::what() const { return message; } JumblePuzzle::JumblePuzzle() { jumble = NULL; size = 0; row = 0; col = 0; direction = 0; } JumblePuzzle::JumblePuzzle(const string& hiddenWord, const string& difficulty) { int dir = rand() % 4; int south_inc, east_inc; string directions = "nesw"; int south_incs[4] = {-1, 0, 1, 0}; int east_incs[4] = {0, 1, 0, -1}; direction = directions[dir]; south_inc = south_incs[dir]; east_inc = east_incs[dir]; int wordLen = hiddenWord.length(); if (wordLen < 3 || wordLen > 10) { throw BadJumbleException("Word is too short. Should be between 3 and 10 letters long."); } if (difficulty == "easy") { size = 2 * wordLen; } else if (difficulty == "medium") { size = 3 * wordLen; } else if (difficulty == "hard") { size = 4 * wordLen; } else { throw BadJumbleException("Invalid difficulty "" + difficulty + "". Difficulty must be "easy", "medium", or "hard", without quotes and in lower case."); } // Pick a spot where the word is sure to fit, based on which way it's going row = rand() % (size - (south_inc ? wordLen - 1 : 0)) + (south_inc == -1 ? wordLen - 1 : 0); col = rand() % (size - ( east_inc ? wordLen - 1 : 0)) + ( east_inc == -1 ? wordLen - 1 : 0); int i, j; jumble = new char*[size]; for (i=0; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote