Battleship game from Headfirst Javascript