-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrockBot.js
More file actions
29 lines (25 loc) · 719 Bytes
/
rockBot.js
File metadata and controls
29 lines (25 loc) · 719 Bytes
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
class Bot {
makeMove(gamestate) {
if (gamestate.rounds.length === 0) {
return 'D';
}
const p1DynamitesPlayed = gameState.rounds.filter(round => round.p1 === "D").length;
const lastOppMove = gameState.rounds[gameState.rounds.length-1].p2;
switch(lastOppMove) {
case "R": if (p1DynamitesPlayed < 100) {
return "D"
} else {
return "P"
};
case "S":
return "R";
case "P":
return "S";
case "D":
return "W";
case "W":
return "R";
}
}
}
module.exports = new Bot();