JS code for battleship game from HFJS