minor refactorings and message fixes
This commit is contained in:
@@ -37,7 +37,7 @@ public class Game {
|
||||
while (players.size() > 1) {
|
||||
Player player = turnTable.getCurrentPlayer();
|
||||
|
||||
System.out.println("Current card: " + currentCard);
|
||||
System.out.printf("Current card: %s%n", currentCard);
|
||||
Card playedCard = player.getPlay(currentCard);
|
||||
if (player instanceof Bot) {
|
||||
new Scanner(System.in).nextLine();
|
||||
@@ -55,9 +55,8 @@ public class Game {
|
||||
System.out.println("You can't end the game with that card!");
|
||||
System.out.println("Take five cards as punishment!");
|
||||
int punishment = 5;
|
||||
for (int i = 0; i < punishment; i++) {
|
||||
player.addCardToHand(dealer.drawCard());
|
||||
}
|
||||
player.drawCards(punishment);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ public class Messages {
|
||||
public static final String KEY_NUMBER_OF_CARDS = "{{numberOfCards}}";
|
||||
|
||||
public static final String WELCOME = "Welcome to Dutch Mau Mau!";
|
||||
public static final String ASK_FOR_PLAYER_NAME = "What shall be thy name?";
|
||||
public static final String BAD_PLAYER_NAME = "What a preposterous reciprocation, thy shall be knoweth as %s%n";
|
||||
public static final String ASK_FOR_PLAYER_NAME = "Hwæt shall be thy namian?";
|
||||
public static final String BAD_PLAYER_NAME = "Hwæt a preposterous reciprocation, thy shall be knoweth as %s%n";
|
||||
public static final String PLAYER_NAME = "Thy shall be knoweth as %s%n";
|
||||
public static final String PLAYER_PLAYED_CARD = KEY_PLAYER_NAME + " played " + KEY_CARD;
|
||||
public static final String PLAYER_DRAW_CARDS = KEY_PLAYER_NAME + " drew " + KEY_NUMBER_OF_CARDS + " cards";
|
||||
|
||||
@@ -40,7 +40,7 @@ public class Bot extends Player {
|
||||
}
|
||||
}
|
||||
hand.add(drawCard());
|
||||
System.out.println(getName() + " drew a card");
|
||||
System.out.printf("%n%s drew a card%n", getName());
|
||||
System.out.println(getName() + " now has " + hand.size() + " cards");
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -29,10 +29,6 @@ public abstract class Player {
|
||||
return hand.isEmpty();
|
||||
}
|
||||
|
||||
public void addCardToHand(Card card) {
|
||||
hand.add(card);
|
||||
}
|
||||
|
||||
public Card drawCard() {
|
||||
return dealer.drawCard();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user