Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
1.50/5 (4 votes)
See more:
Hey everyone,
For setting up Exercise 12.15, I was unsure how to do this. Originally I planned to add another value of " " to alphabet to represent wild card, and then do a separate if loop for if this occurred but I realized " " is not a character so it doesn't work. Can you give me an idea of how to perform this exercise 12.15?

Here is the exercise:

Exercise 12.15. In real Scrabble, there are some blank tiles that can be
used as wild cards; that is, a blank tile can be used to represent any letter.
Think of an algorithm for canSpell that deals with wild cards. Implement it into your code.
Posted
Updated 16-Nov-15 9:36am
v4
Comments
Sergey Alexandrovich Kryukov 15-Nov-15 13:54pm    
Sorry, a request for suggestions is not a question. We really need your question, to provide some help.
—SA
jeffbezzz 5-Apr-22 19:53pm    
Where is the code he is trying to show?

I don't know where you have a problem.Please update your question with a specific problem.
But when I tried to solve the error by copying your code above it seems that you have additionally added "}" at the last of your program .when I removed it, the output comes "true" .
I think this is the output of your Boolean.Hope this helps.
 
Share this answer
 
v2
Comments
gettysburggal63 15-Nov-15 14:22pm    
That must've been the issue! When I ran the program, nothing showed up in the console, but now it works. Can you help me to implement exercise 12.15?
[no name] 15-Nov-15 14:58pm    
Kindly excuse me because I don't know how to play scrabble.So,I can only help you If you have a specific problem in your code.
gettysburggal63 15-Nov-15 15:58pm    
Oh, I see. Basically what I need to do is I need to add another possibility for a blank tile, ' ', and if a person draws this tile in myTiles, it can act as any one tile they are missing in the tiles needed for a word they are trying to spell!
gettysburggal63 15-Nov-15 15:59pm    
For example, if they were trying to spell jib and they had quijio and a blank tile, the blank tile could be used as a 'b' and they could still spell the word
[no name] 16-Nov-15 8:26am    
I hope this is the concept of the game.Please inform if this is wrong.

solution:
Try adding blank tile to your "myTiles",

quote:
String tiles = "quijo*";
String targetWord = "jib";
* represents a blank tile
2<3
so your condition becomes false
and so try adding this to increment a single value

if(index!=alphabet[a])
myTilesCounter[a]++;

so 3=3
true

Hope this helps.
please check your brackets! that seems to be the issue
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900