Курсовая работа: Программа "Морской бой"
int Referee: GoScaning (int x, int y, int n)
{
if (n == 1)
if (! Scan(player, x, y))
return 0;
if (n == 2)
if (! Scan(CPU, x, y))
return 0;
return 1;
}
// –
int Referee: Scan (Flot *fl, int x, int y)
{
x /= 20; y /= 20;
for (i = 0; i < 10; i++)
for (j = 0; j < fl -> ship[i].col_deck; j++)
if (fl -> ship[i].desp_of_part[j].x == x &&
fl -> ship[i].desp_of_part[j].y == y)
{
fl -> ship[i].decks[j] = false;
return 0;
}
return 1;
}
// –
int Referee: Miss (int x, int y, int n)
{
x /= 20; y /= 20;
if (n == 1) net1 [x] [y] = false;