23 lines
581 B
Java
23 lines
581 B
Java
package domain;
|
|
|
|
public class Player {
|
|
int playerNumber;
|
|
String name;
|
|
String color;
|
|
int score;
|
|
|
|
public Player(int playerNumber, String name, String color, int score) {
|
|
this.playerNumber = playerNumber;
|
|
this.name = name;
|
|
this.color = color;
|
|
this.score = score;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
String ANSI_RESET = "\u001B[0m";
|
|
String coloredName = String.format(this.color + this.name + ANSI_RESET);
|
|
return String.format("Name: %s, Colored name: %s \n", this.name, coloredName);
|
|
}
|
|
}
|