int OlsonAttack(int mode, int opponent) //ATTACK FUNCTION
{
int column;
char row;
int ret;
//****** STATUS VERIABLES ******//
staticint board[BS_GRID_ROWS][BS_GRID_COLS]; // board will not change
staticbool turn; //allows turn to end || not to fire > once
staticbool hit; //fired is for shot per turn
//***********************************//
switch(mode) {
case BS_MODE_NEW_GAME: //NEW GAME
turn = true;
for (row = 0; row < BS_GRID_ROWS; row++) //search/increment row
for(column = 1; column < BS_GRID_COLS; column++) //search increment column
board[row+'A'][column] = 0;
break;
case BS_MODE_CONTINUE_GAME: //CONTINUE GAME (no error)
turn = true;
if (!hit) {
do {
row = rand() % BS_GRID_ROWS;
column = rand() % BS_GRID_COLS;
}while (board[row+'A'][column] == 1);
board[row+'A'][column] = 1; //Marks a probed unit of space on array
ret = fire[opponent](row + 'A', column + 1);
}
break;
}
return 0;
}