-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPokemiltonWorld.js
43 lines (38 loc) · 899 Bytes
/
PokemiltonWorld.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
var readline = require("readline/promises");
rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: false,
});
class PokemiltonWorld {
constructor(name) {
this.name = name;
this.day = 1;
this.logs = [];
this.saved_on = "";
}
oneDayPasses() {
this.day++;
console.clear();
this.addLog(
`One day passes. No Pokemilton in the neighbourhood... maybe tomorrow. Day ${this.day} in ${this.name} town.`
);
this.addLog(`________________________________________________`);
}
randomizeEvent() {
let randomNumber = (Math.random() * 8) / 10;
if (randomNumber < 2 / 10) {
return false;
} else {
return true;
}
}
addLog(newLog) {
console.log(newLog);
this.logs.push(newLog);
}
readLog() {
this.logs.map((log) => console.log(log));
}
}
module.exports = PokemiltonWorld;