скачать книгу бесплатно
{
if (thn [x, y] == cpu) gh++;
if (thn [x, y] == plr)
{hg++; score = score – 4000;}
}
}
}
if (gh> 1) score = score + (gh – 1) * 500;
if (gh == 1) score = score – 100;
if (hg> 1) score = score – (hg – 1) * 500;
for (x = 0; x <7; x++)
{
gh = 0;
for (y = 1; y <6; y++)
{
/*if (gh==0)
if ((thn [x,y]> 0) && (arr [x,y-1] ==0)) {
gh=1;
} */
if ((thn [x, y] == cpu) &&
(thn [x, y – 1] == cpu))
{
u = 0; j = 0;
for (o = y – 1; o> -1; o – )
{
if (thn [x, o] == plr) u = 1;
if (arr [x, o] == 0) j++;
}
if (u == 0) score = score +1300 – j * 7;
if (u == 1) score = score +300;
}
if ((thn [x, y] == plr) &&
(thn [x, y – 1] == plr))
{
u = 0; j = 0;
for (o = y – 1; o> -1; o – )
{
if (thn [x, o] == cpu) u = 1;
if (arr [x, o] == 0) j++;
}
if (u == 0) score = score – 1500 + j * 7;
if (u == 1) score = score – 300;
}
if (thn [x, y] == plr)
{
u = 0;
for (o = y – 1; o> -1; o – )
{
if (thn [x, o] == cpu) u = 1;
}
if (u == 1) score = score +30;
}
if (thn [x, y] == cpu)
{
u = 0;
for (o = y – 1; o> -1; o – )
{
if (thn [x, o] == plr) u = 1;
}
if (u == 1) score = score – 30;
}
}
}
return score;
}
public int checkhole (int x, int y)
{
int score = 0;
int max, min;
int d0 = 0, d1 = 0, d2 = 0, d3 = 0;
if (((x +1) <7) && ((y – 1)> -1))
{
if (arr [x +1, y – 1] == cpu)
{
d1++;
if (((x +2) <7) && ((y – 2)> -1))
{
if (arr [x +2, y – 2] == cpu)
{
d1++;
if (((x +3) <7) && ((y – 3)> -1))
{
if (arr [x +3, y – 3] == cpu)
d1++;
}
}
}
}
}
if (((x – 1)> -1) && ((y +1) <6))
{
if (arr [x – 1, y +1] == cpu)
{
d1++;
if (((x – 2)> -1) && ((y +2) <6))
{
if (arr [x – 2, y +2] == cpu)
{
d1++;
if (((x – 3)> -1) && ((y +3) <6))
{
if (arr [x – 3, y +3] == cpu) d1++;
}
}
}
}
}
if (((x – 1)> -1) && ((y – 1)> -1))
{
if (arr [x – 1, y – 1] == cpu)
{
d2++;
if (((x – 2)> -1) && ((y – 2)> -1))
{
if (arr [x – 2, y – 2] == cpu)
{
d2++;
if (((x – 3)> -1) && ((y – 3)> -1))
{
if (arr [x – 3, y – 3] == cpu) d2++;
}
}
}
}
}
if (((x +1) <7) && ((y +1) <6))
{
if (arr [x +1, y +1] == cpu)
{
d2++;
if (((x +2) <7) && ((y +2) <6))
{
if (arr [x +2, y +2] == cpu)
{
d2++;
if (((x +3) <7) && ((y +3) <6))
{
if (arr [x +3, y +3] == cpu) d2++;
}
}
}
}
}
if ((y – 1)> -1) if (arr [x, y – 1] == cpu)
{
d0++;
if ((y – 2)> -1) if (arr [x, y – 2] == cpu)
{
d0++;
if ((y – 3)> -1)
if (arr [x, y – 3] == cpu) d0++;
}
}
if (x – 1> -1)
{
if (arr [x – 1, y] == cpu)
{
d3++;
if (x – 2> -1)
{
if (arr [x – 2, y] == cpu)
{
d3++;
if (x – 3> -1)
if (arr [x – 3, y] == cpu) d3++;
}
}
}
}
if (x +1 <7)
{
if (arr [x +1, y] == cpu)
{
d3++;
if (x +2 <7)
{
if (arr [x +2, y] == cpu)
{
d3++;
if (x +3 <7)
if (arr [x +3, y] == cpu) d3++;
}
}
}
}
max = d0;
if (d1> max) max = d1;
if (d2> max) max = d2;
if (d3> max) max = d3;
if (max == 2) score = score +5;
if (max> 2)
{
score = score +71; thn [x, y] = cpu;
if ((d1 <3) && (d2 <3) && (d3 <3))
score = score – 10;
}
if (((x +1) <7) && ((y – 1)> -1))
{
if (arr [x +1, y – 1] == plr)