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