Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBhawani Shankar
954 PointsPlease help me do no answer just give me hints how to do this one .
I want to to this code by my own just guide me i am lost:(
public class ScrabblePlayer {
// A String representing all of the tiles that this player has
private String tiles;
public ScrabblePlayer() {
tiles = "";
}
public String getTiles() {
return tiles;
}
public void addTile(char tile) {
// TODO: Add the tile to tiles
}
public boolean hasTile(char tile) {
// TODO: Determine if user has the tile passed in
return false;
}
}
Steven Sullivan
11,616 PointsYou want the tile from (char tile) to be added the String called tiles.
Add tile, to tiles.
Try some operators between the two that would add them. Be sure to end with a semicolon.
Bhawani Shankar
954 Points// TODO: Add the tile to tiles Do this for me
Steven Sullivan
11,616 Pointstile += tiles;
I might have it backwards, it might be tiles += tile;
Bhawani Shankar
954 Pointscan you explain how Scrabble is played?
Steven Sullivan
11,616 PointsScrabble is a board game where each player (2-4) pulls 7 random tiles from a bag, each tile is a letter from the alphabet. There's multiple tiles for each letter, so a player can have any combination of letters.
In a clockwise or counterclockwise rotation, players begin using their tiles to form words on the board for points. The longer the word, or the higher the modifier on the space you play your tiles on the board, the more points you get.
After a word is played, the following player forms a word that is connected to a word played on the board, utilizing a letter from it.
The game is over when nobody can form any more words, and the player with the highest score wins.
Ben McDowell
1,784 PointsBen McDowell
1,784 PointsSo to start this, you'll need to maintain the players hand as "tiles".
The methods from your snippet show that your going to need to manipulate that string in a couple of different ways. I'd check out the java documentation on how to do that.
That's not super helpful, but I'd need more information about what you are stuck on.