Sem 1.1
Array Snippets
Pet[] pets = new Pet[10];
pets[0] = new Pet("Bingo", 2);
for (Pet p : pets)
{
if (p != null)
p.feed();
}
[
else
{
currentPlayer = 1;
}
]
[
if (correct && !solved)
{
if (currentPlayer == 1)
{
player1.addToPoints(game.getLetterValue());
}
]
[
int currentPlayer = 1; // set current player to Player 1
]
[
if (currentPlayer == 1)
{
System.out.println(player1.getName() + " guess: ");
}
]
[
System.out.println(player2.getName() + " points:" + player2.getPoints());
]
[
game.setLetterValue();
System.out.println(game.getSolvedPhrase());
game.setLetterValue();
System.out.println("Current Letter Value: "+ game.getLetterValue());
]
[ correct = true; ]
[ solved = game.isSolved(guess);]
while (correct)
//phraseSolver Class
// public PhraseSolver()
// Create Instance Variables
// Create object references using the Player and Board constructors 1.2.2
// Let's Play
// play()
// set current player to Player 1
// stop the game if the phrase is solved game - "While (!solved)"
// stop player turn if guess wrong - While(correct)
// Start turn - player 1 would make guess
//
// Show how many points is the turn worth
// EC - Determine if points for just turn or per letter correct
// Show board with _ and empty spaces
// prompt the current player for a guess Show name of current player for guess
// check to see if the phrase is solved
// check to see if the letter is in the phrase
// if correct give points to appropriate Player
// end of while (correct)
// - switch players if the guess is incorrect
// end of while (!solved)
//end of play
//
// Player class
// public Player()
// public Player(String inputName)
// Getter getName()
// Setter setName(String inputName)
// Getter getPoints()
// Setter addToPoints(int value)
//Board class
// public Board()
// getPhrase()
// getSolvedPhrase()
// getLetterValue()
// setLetterValue()
// isSolved(String guess)
// loadPhrase()
// guessLetter(String guess)
//15a) The solvedPhrase attribute stays as the empty string.
//15b> Use the provided loadPhrase method to initialize the attribute phrase.
//15c> Replace your initialization of currentLetterValue with a call to setLetterValue. Notice this method does not return a value.
//15d> For testing purposes, add the following line of code at the end for testing. (You will remove this line in your final program.)
//getter for phrase using loadphrase
//getter for solved phrase
//getter for current letter value
//getter for current letter value
// constructor for setting random score int to currentLetterValue
// constructor with parameter "guess" to check to see if phrase is solved
// constructor to loadphrase from text file then convert char to _ and spaces
// Constructor to guessLetter and return foundLetter