Skip to content

Commit

Permalink
Update Player.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Antenehden authored Jul 26, 2024
1 parent 25b00b2 commit 7c0fa2b
Showing 1 changed file with 43 additions and 8 deletions.
51 changes: 43 additions & 8 deletions src/main/java/uta/cse3310/Player.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package uta.cse3310;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

public class Player {
Expand All @@ -8,8 +10,18 @@ public class Player {
private int score;
private boolean iswinner;
private GameTimer timer; // Updated reference
private List<Character> boughtVowels;
private List<Character> guessedConstants;


public Player(String name) {
this.id = UUID.randomUUID().toString();
this.name = name;
this.score = 1000;
this.timer = new GameTimer(); // Updated reference
this.boughtVowels = new ArrayList<>();
this.guessedConstants = new ArrayList<>();
}

public boolean isWinner() {
return iswinner;
Expand All @@ -19,13 +31,6 @@ public void setWinner(boolean iswinner) {
this.iswinner = iswinner;
}

public Player(String name) {
this.id = UUID.randomUUID().toString();
this.name = name;
this.score = 0;
this.timer = new GameTimer(); // Updated reference
}

public String getId() {
return id;
}
Expand All @@ -42,10 +47,40 @@ public void addScore(int points) {
this.score += points;
}

public void deductScore(int points) {
this.score -= points;
}

public void resetScore() {
this.score = 0;
}
}

public GameTimer getTimer() {
return timer;
}

public boolean hasBoughtVowel(char vowel) {
return this.boughtVowels.contains(vowel);
}

public void buyVowel(char vowel) {
this.boughtVowels.add(vowel);
}

public List<Character> getBoughtVowels() {
return this.boughtVowels;
}

public void guessConstant(char constant) {
this.guessedConstants.add(constant);
}

public List<Character> getGuessedConstants() {
return this.guessedConstants;
}

public boolean hasGuessedConstant(char constant) {
return this.guessedConstants.contains(constant);
}
}

0 comments on commit 7c0fa2b

Please sign in to comment.