Skip to content

Commit 6d7f524

Browse files
committed
Add comments
1 parent 2bc87c5 commit 6d7f524

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

behavioral-patterns/strategy/main.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ const player2 = new Player('James', new MirrorStrategy());
1616
for (let i = 0; i < 100; i++) {
1717
const handOfPlayer1 = player1.showHandSignal();
1818
const handOfPlayer2 = player2.showHandSignal();
19+
20+
// Judge win, loss, or draw
1921
let resultOfPlayer1;
2022
let resultOfPlayer2;
2123
if (handOfPlayer1.isStrongerThan(handOfPlayer2)) {
@@ -33,6 +35,7 @@ for (let i = 0; i < 100; i++) {
3335
resultOfPlayer1 = GameResultType.Draw;
3436
resultOfPlayer2 = GameResultType.Draw;
3537
}
38+
3639
player1.notifyGameResult(resultOfPlayer1, handOfPlayer1, handOfPlayer2);
3740
player2.notifyGameResult(resultOfPlayer2, handOfPlayer2, handOfPlayer1);
3841
}

0 commit comments

Comments
 (0)