Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool CAI_Player::DwaPola()
- {
- FIELD a[3];
- int b[3];
- int wlasnei, cudzei;
- KOORDYNATY wlasne;
- KOORDYNATY cudze;
- wlasne.y = -1;
- wlasne.x = -1;
- cudze.y = -1;
- cudze.x = -1;
- for (int i = 0; i < 8; ++i)
- {
- for (int j = 0; j < 3; ++j)
- {
- a[j] = this->CPTablica->SprawdzWartPola(LINIE[i][j][0], LINIE[i][j][1]);
- b[j] = j;
- }
- int lineArg[] = { 2, 0, 1 };
- for (int x = 0; x < 3; x++) {
- int xPlus = x != 2 ? x + 1 : 2;
- int xRetard = x != 1 ? 0 : 1;
- if (a[xRetard] == a[xPlus] && a[x] != FLD_EMPTY && a[lineArg[x]] == FLD_EMPTY)
- {
- if (a[0] == znak)
- {
- wlasne.y = LINIE[i][b[lineArg[x]]][0];
- wlasne.x = LINIE[i][b[lineArg[x]]][1];
- wlasnei = i;
- }
- else
- {
- cudze.y = LINIE[i][b[lineArg[x]]][0];
- cudze.x = LINIE[i][b[lineArg[x]]][1];
- cudzei = i;
- }
- break;
- }
- }
- }
- if (wlasne.y != -1)
- {
- this->kWewKord.y = wlasne.y;
- this->kWewKord.x = wlasne.x;
- return true;
- }
- if (cudze.y != -1)
- {
- this->kWewKord.y = cudze.y;
- this->kWewKord.x = cudze.x;
- return true;
- }
- else
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement