1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
while(placementFailure)
{
if(d=='h')
{
cS=checkSpaces(grid, col, row, BoatSize, d);
if(cS==1)
{
d=getDirection(rand()%10);
col=resetColAndRow(col, row, BoatSize, d);
GO BACK TO TOP OF LOOP HERE...
}
cout << "do edit grid from IF HORIZONTAL" << endl;
editGrid(grid, col, row, BoatSize, d);
return 0;
}//end of 'if horizontal'
else
{
cS=checkSpaces(grid, col, row, BoatSize, d);
cout << "checkSpaces is: " << checkSpaces << endl;
if(cS==1)
{
d=getDirection(rand()%10);
col=resetColAndRow(col, row, BoatSize, d);
cout << "if not checkSpaces..." ;
GO BACK TO TOP OF LOOP HERE...
}
cout << "do edit grid FROM VERTICAL" << endl;
editGrid(grid, col, row, BoatSize, d);
return 0;
}
}
}//end of setBoat function
|