Class

Hole

Hole(player, board, id, numSeeds, prevHole, nextHole)

Constructor

# new Hole(player, board, id, numSeeds, prevHole, nextHole)

Constructor
Parameters:
Name Type Description
player Player The player to whom this hole is being assigned to
board Board The board on which the hole is placed
id number Unique hole ID (Ranging 0-16) -1 is used for the dummy pointer to the first hole.
numSeeds number Number of seeds to be initially added to the hole.
prevHole Hole The hole that is before this hole.
nextHole Hole The hole that comes up next in clockwise fashion

View Source core/Hole.ts, line 60

Methods

# adjacencyDirection(targetHole) → {MoveDirection}

Calculates the move direction that corresponds to a users drag and drop action. Seeds are dragged from an origin hole into the target hole. The direction is only returned if the target hole is adjacent to the origin.
Parameters:
Name Type Description
targetHole Hole the hole into which the seeds are being dragged into

View Source core/Hole.ts, line 206

the direction that corresponds to the users drag and drop action.

# availableMovesForCurrentPlayer() → {Array.<Move>}

Gets the moves that are available for the current player

View Source core/Hole.ts, line 186

moves that can be played
Array.<Move>

# isEmpty() → {boolean}

Checks to see if the hole contains any seeds

View Source core/Hole.ts, line 92

true if seeds are present
boolean

# isInFrontRow() → {boolean}

Check if this hole is in the front row (Front rows are allowed to capture seeds from enemy side).

View Source core/Hole.ts, line 79

true is the hole is in the front row for the owning player.
boolean

# renderUI()

Renders the hole and its contents (seeds)

View Source core/Hole.ts, line 222

# transferAllSeedsToCurrPlayer() → {number}

Moves all seeds from the hole into players hand - clearing it to a count of 0.

View Source core/Hole.ts, line 103

The number of seeds that were moved from hole into players hand.
number

# transferSeedsFromCurrPlayer(numSeeds) → {number}

Removes seeds from players hand
Parameters:
Name Type Description
numSeeds number Number of seeds to be removed from players hand

View Source core/Hole.ts, line 128

Number of seeds removed from the player hand
number

# validateFinalSeedCount(numSeeds)

Checks if the the total number of seeds in players hand is valid
Parameters:
Name Type Description
numSeeds number Number of seeds in players hand after adding or removing

View Source core/Hole.ts, line 170

# validateNumSeeds(numSeeds)

Checks if the number of seeds to be added or removed from players hand is valid
Parameters:
Name Type Description
numSeeds number Number of seeds to be added or removed from players hand

View Source core/Hole.ts, line 151