From ebd2fef54ce3c482d1f8dd3fc331953b54c6ee10 Mon Sep 17 00:00:00 2001 From: Halit Aksoy Date: Sun, 8 May 2022 16:58:56 +0300 Subject: [PATCH] add checkPitTypeIsNormalPitByIndex and checkPitTypeIsBankByIndex --- src/core/Board.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/core/Board.ts b/src/core/Board.ts index b4efe9d..cdb17c6 100644 --- a/src/core/Board.ts +++ b/src/core/Board.ts @@ -83,6 +83,18 @@ export class Board { } } + public checkPitTypeIsNormalPitByIndex(index: number): boolean { + this.checkIndeAndMaybeThrowError(index); + const pitType = this.getPitTypeByIndex(index); + return pitType === 'player1Pit' || pitType === 'player2Pit'; + } + + public checkPitTypeIsBankByIndex(index: number): boolean { + this.checkIndeAndMaybeThrowError(index); + const pitType = this.getPitTypeByIndex(index); + return pitType === 'player1Bank' || pitType === 'player2Bank'; + } + public move(index: number) { this.checkIndeAndMaybeThrowError(index); const pitType = this.getPitTypeByIndex(index);