complete battleship.js logic