Make the board argument an array of any type.
This commit is contained in:
parent
b109c0d082
commit
ec37881de7
1 changed files with 2 additions and 2 deletions
|
|
@ -8,7 +8,7 @@
|
||||||
* @returns An object containing the number of ships that are on each side of
|
* @returns An object containing the number of ships that are on each side of
|
||||||
* the target ship
|
* the target ship
|
||||||
*/
|
*/
|
||||||
function countShips(board: string[], shipLocation: number) {
|
function countShips(board: any[], shipLocation: number) {
|
||||||
return {
|
return {
|
||||||
left: board.slice(1, shipLocation - 1).filter(x => x != null).length,
|
left: board.slice(1, shipLocation - 1).filter(x => x != null).length,
|
||||||
right: board.slice(shipLocation + 1).filter(x => x != null).length,
|
right: board.slice(shipLocation + 1).filter(x => x != null).length,
|
||||||
|
|
@ -27,7 +27,7 @@ function countShips(board: string[], shipLocation: number) {
|
||||||
* - `0` = Not moving
|
* - `0` = Not moving
|
||||||
* - `1` = Towards the Warp Gate
|
* - `1` = Towards the Warp Gate
|
||||||
*/
|
*/
|
||||||
export function determineDirection(board: string[], shipLocation: number) {
|
export function determineDirection(board: any[], shipLocation: number) {
|
||||||
let delta = 1;
|
let delta = 1;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue