Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

// Data members int mLetterValues[26]; std::unordered_map mScrabbleMap; public: // In Scrabble, each letter has a value associated with it. // This method will populate the

// Data members

int mLetterValues[26];

std::unordered_map mScrabbleMap;

public:

// In Scrabble, each letter has a value associated with it.

// This method will populate the array of letter values.

//

// In: _letterValues The array of 26 values

void PopulateLetterValues(const int* _letterValues) {

// TODO: Implement this method

}

// Retrieve the value of a particular letter

//

// In: _letter The letter to get the score for

//

// Return: The score value for the letter passed in

// NOTE: The letter passed in will always be upper-case

int GetLetterValue(char _letter) const {

// TODO: Implement this method

}

// Get the value of a word

// This is done by adding up the values of each letter in the word

//

// In: _word The word to get the value of

//

// Return: The total value of the word

int GetWordValue(const std::string& _word) const {

// TODO: Implement this method

}

// Create a pair to add into the scrabbleMap

// This will have a "first" of the word, and a "second" of the total score

//

// In: _word The word for the pair

//

// Return: A pair that contains the word and the total score

std::pair CreatePair(const std::string& _word) const {

// TODO: Implement this method

}

// Load a file containing all of the possible scrabble words, along with their values

// This file will contain one word per line

// In: _filename The name of the file to load

//

// Note: You may want to use one or more existing methods to help.

void LoadWords(const char* _filename) {

// TODO: Implement this method

}

// Searches for a word in the map, and retrieves the score for that word

//

// In: _word The word to search for

//

// Return: The word score for _word (or -1 if not found)

int FindValueInMap(const std::string& _word) {

// TODO: Implement this method

}

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Programming questions