i have done coding for the board but now I'm stuck on getting randomizing ship placement for player1 and player2
So far for ship placement all i have is the function prototype.
#include <stdio.h> #include <stdlib.h> #include <time.h> int placeship( int x, int z[ ][ 10 ] ); // function
each player has 5 ships
carrier = 5 spaces
battleship = 4 spaces
destroyer = 3 spaces
submarine = 3 spaces
patrol = 2 spaces
I need to build a randomizer for ship placement on a 10x10 board(i've built the board)
i've to built it in a way that they don't overlapp each other, don't go off the board.
how would i go about doing this.
I've been stuck on this for days and i'm seriously getting depressed from this.