Player's input in Scrabble?
Argh.. this is getting frustrated. I fix one problem, another one appears. I am now having trouble on how to take in the user's input in a game of Scrabble. Consider the first player already went, and placed down his word:
This word was entered by asking the user for a proper location and the FULL WORD that he wants to make.
Now the next player's turn.
How should I get his input? If I get in terms of location and letters, I can make a new word like this
(just adding the letter S at location (0,4) for this case)
or like this with location of (1,1) But what if the user wants a word like this:
then you are not just adding letters to preexisiting words but also adding letter(s) before and after. I looked into entering the whole word and the location but that won't work, if you want to make multiple words using your letters.
I hope you guys understand what I am trying to say. Plz ask for any clarification as required.
Once again, thanks
Helix
Re: Scanning all directions?
Quote:
Originally posted by vex_helix
I like yr idea Quzah regarding entering one at a time. But how do I check all directions for words?
Consider initial words:
And I make both NOT AND BET Since 'T' was the last character typed, I only use 'T' to scan up,down,right,left to find words?
Then don't "only use 'T'." You must use all tiles played. Keep track of the positions played and go back thru them to test for additional words in the 'other' direction.
This may make my suggestion better because with quzah's code, you not only have to enter every single letter being placed, but you have to analyze the placement to figure out the direction. In my solution, you already know the direction.
Quote:
Originally posted by vex_helix
What about this scenario:
and I make three words ON, NO, TO respectively:
In this case I gotta check all directions for both 'N' and 'O'.
Isn't there just one simple way to scan for words for all direction? Also, do I scan as I enter words?
Yes. See above.