From a65ed8fe16a057f390349a7601fdf2d7a0faa512 Mon Sep 17 00:00:00 2001 From: Halit Aksoy Date: Mon, 2 May 2022 00:41:01 +0300 Subject: [PATCH] add pit --- src/core/Pit.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/core/Pit.ts diff --git a/src/core/Pit.ts b/src/core/Pit.ts new file mode 100644 index 0000000..5081e1b --- /dev/null +++ b/src/core/Pit.ts @@ -0,0 +1,29 @@ +export class Pit { + stoneCount: number; + + constructor(stoneCount = 0) { + this.stoneCount = stoneCount; + } + + get isBank(): boolean { + return false; + } + + public increaseStone(count = 1) { + this.stoneCount += count; + } + + public decreaseStone(count = 1) { + this.stoneCount -= count; + } +} + +export class Bank extends Pit { + constructor(stoneCount = 0) { + super(stoneCount); + } + + override get isBank(): boolean { + return true; + } +}