Allow TS to import countShips internally

This commit is contained in:
Oliver Akins 2022-06-19 12:41:37 -06:00
parent 762e2bdb1b
commit 1167c10707
No known key found for this signature in database
GPG key ID: 3C2014AF9457AF99

View file

@ -1,14 +1,15 @@
/**
* @internal
* A helper method for counting how many ships are on each side of a specific
* ship on the board.
*
* @param board The array of spaces that represents the Gravwell board
* @param shipLocation The index of the ship that we are counting the number of
* ships on each side for.
* ships on each side for.
* @returns An object containing the number of ships that are on each side of
* the target ship
* the target ship
*/
function countShips(board: any[], shipLocation: number) {
export function countShips(board: any[], shipLocation: number) {
return {
left: board.slice(1, shipLocation - 1).filter(x => x != null).length,
right: board.slice(shipLocation + 1).filter(x => x != null).length,