Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

AA AAH AAHED AAHING AAHS AAL AALII AALIIS AALS AARDVARK AARDVARKS AARDWOLF AARDWOLVES AARGH AARRGH AARRGHH AAS AASVOGEL AASVOGELS AB ABA ABACA ABACAS ABACI ABACK

image text in transcribedimage text in transcribedimage text in transcribed

AA AAH AAHED AAHING AAHS AAL AALII AALIIS AALS AARDVARK AARDVARKS AARDWOLF AARDWOLVES AARGH AARRGH AARRGHH AAS AASVOGEL AASVOGELS AB ABA ABACA ABACAS ABACI ABACK ABACTERIAL
CS210 HW3 Algorithm due Monday, Feb 29 Program due Monday, March 8 Cheating at Scrabble Scrabble is a game that is played by making words. Each player gets a set of tiles, each with one letter on it. They then need to make a word out of those letters. Additionally, those letters need to connect someplace to a letter already placed on the board. I've posted a (possibly old- it's from 2006) list of legal Scrabble words on Blackboard. The file has one word per line. There are some "bad" words in there, but I trust you to be adult about the whole thing. Since you'll be looking at the word list a lot, you probably want to read it into a vector of strings at the start of the program. Your job is to write a program that: - Asks the user for a string of letters that they have in their hand. Asks the user for a letter to be placed on the board. The letter can be placed at the beginning or end of the word. (You should ask the user). Using a recursive backtracking function, finds all legal words that can be made out of some subset of the letters in the player's hand, with the board letter either at the beginning or end of the word (depending on what the user entered). Each tile will be used at most once, but it's possible for two different tiles to have the same letter. Prints out the score for the word. The score is based on the letters used: 1 N gi possible for two different tiles to have the same letter. Prints out the score for the word. The score is based on the letters used: B D E F 1 1 3 10 1 3 3 2 1 4 2 4 1 8 5 1 3 N 0 P R S T U V w Y Z 1 1 1 1 H 1 4 11 K L M 4 8 4 10 Note that this program is due in two weeks because I think it's more complicated than a typical homework. You will likely need more time than usual, to do this homework. Plan accordingly! In fact, by next Monday, I'm requiring that you hand in an algorithm of your homework. An algorithm is a step-by-step description of how your program will work. This is worth 25% of your homework grade. If you hand in the whole homework by next Monday, you won't have to do the algorithm. In your algorithm, I'm especially looking for how you'll get your backtracking function to work. What will you do each recursive call? What is your base case? How will you backtrack? Keep in mind that you'll need to try all combinations of letters. My program works by keeping a Boolean vector of "letters used" that I set to true once I added it to a word I was making, to make sure I don't use it again. (Though also keep in mind that if a letter occurs twice (or more) in your current letter list, you can use it twice (or more) in a word you're created) Also keep in mind that the word list is really big and in sorted order. You should use Binary Search to see if a word is in the list. My program is almost instantaneous (after reading the word list into a vector initially) with Binary Search, but takes several minutes to run with sequential search. Sample Run( Entries in bold are user input) Enter the name of the wordlist file: TWL06.txt what are your current letters? ABCDEFG what letter is on the board? H Is this letter the beginning of the word? y HA 5 HAD 7 HADE 8 HAE 6 HAED 8 HAG 7 HE 5 HEAD 8 Go again? (y) y what are your current letters? ABCDEFG what letter is on the board? H

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

Recommended Textbook for

Databases Illuminated

Authors: Catherine Ricardo

2nd Edition

1449606008, 978-1449606008

More Books

Students also viewed these Databases questions

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago