We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2bc87c5 commit 6d7f524Copy full SHA for 6d7f524
behavioral-patterns/strategy/main.mjs
@@ -16,6 +16,8 @@ const player2 = new Player('James', new MirrorStrategy());
16
for (let i = 0; i < 100; i++) {
17
const handOfPlayer1 = player1.showHandSignal();
18
const handOfPlayer2 = player2.showHandSignal();
19
+
20
+ // Judge win, loss, or draw
21
let resultOfPlayer1;
22
let resultOfPlayer2;
23
if (handOfPlayer1.isStrongerThan(handOfPlayer2)) {
@@ -33,6 +35,7 @@ for (let i = 0; i < 100; i++) {
33
35
resultOfPlayer1 = GameResultType.Draw;
34
36
resultOfPlayer2 = GameResultType.Draw;
37
}
38
39
player1.notifyGameResult(resultOfPlayer1, handOfPlayer1, handOfPlayer2);
40
player2.notifyGameResult(resultOfPlayer2, handOfPlayer2, handOfPlayer1);
41
0 commit comments