Battleship game in HTML5 Canvas and JavaScript