Methods
# getHoleWithID(holeId) → {Hole}
Retrieves the Hole from the board using its given ID.
Parameters:
Name | Type | Description |
---|---|---|
holeId |
number
|
ID to be used to retrieve hole |
Retrieved hole
# insertAtEnd(numSeeds) → {Hole}
Add new Holes at the end of the chain.
Parameters:
Name | Type | Description |
---|---|---|
numSeeds |
number
|
Number of seeds to be placed in the hole. |
Added Hole
# stepAntiClockwise(boardHole, numSteps) → {Hole}
Step back anti-clockwise for the specified number of steps.
Parameters:
Name | Type | Description |
---|---|---|
boardHole |
Hole
|
Starting Hole |
numSteps |
number
|
Number of steps to move backwards. |
Hole
# stepClockwise(boardHole, numSteps) → {Hole}
Step forward clockwise for the specified number of steps.
Parameters:
Name | Type | Description |
---|---|---|
boardHole |
Hole
|
Starting Hole |
numSteps |
number
|
Number of steps to move backwards. |
The destination hole.
# validateHoleId(holeId)
Make sure that all the 16 holes have been added before attempting to retrieve
any.
Parameters:
Name | Type | Description |
---|---|---|
holeId |
number
|
Hole id to be validated. |
# validateNumSteps(numSteps)
Allow positive integers less than 64 for numSteps.
Parameters:
Name | Type | Description |
---|---|---|
numSteps |
number
|
Number of steps to be made. |