O'Reilly logo
  • Ahmed Elgendy thinks this is interesting:

Writing the generateShip method

The generateShip method creates an array with random locations for one ship without worrying about overlap with other ships on the board. We’ll go through this method in a couple of steps. The first step is to randomly p...


Cover of Head First JavaScript Programming


How to generate random positions for the ships both vertically and horizontally?