2021-06-17 06:45:45 +00:00
|
|
|
class Player {
|
2021-06-17 16:33:16 +00:00
|
|
|
constructor(name) {
|
|
|
|
this.name = name;
|
2021-06-17 06:45:45 +00:00
|
|
|
this.position = 0;
|
|
|
|
this.isAlive = true;
|
|
|
|
}
|
|
|
|
|
2021-06-17 16:33:16 +00:00
|
|
|
move_by(amount) {
|
2021-07-01 12:46:18 +00:00
|
|
|
if(this.position > 11){
|
|
|
|
this.position++;
|
|
|
|
}else if(this.position+amount > 11){
|
|
|
|
this.position = 12;
|
|
|
|
}else{
|
|
|
|
this.position += amount;
|
|
|
|
}
|
2021-06-17 06:45:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Player;
|