fix hardcoded 4 -> n/2
This commit is contained in:
parent
e02a7d2b43
commit
3bf38441f5
@ -17,7 +17,7 @@ bool GameState::_checkEnd() const {
|
|||||||
if (C[cp][i] >= (n + 1) / 2)
|
if (C[cp][i] >= (n + 1) / 2)
|
||||||
v += 1;
|
v += 1;
|
||||||
}
|
}
|
||||||
return v >= 4;
|
return v >= (n + 1) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameState::move(int x, int y) {
|
bool GameState::move(int x, int y) {
|
||||||
|
@ -16,7 +16,7 @@ std::tuple<int, int> getMove(int lstX, int lstY) {
|
|||||||
if (lstX != -1) {
|
if (lstX != -1) {
|
||||||
ctl[0][B[lstX][lstY]] += 1;
|
ctl[0][B[lstX][lstY]] += 1;
|
||||||
int t = B[lstX][lstY];
|
int t = B[lstX][lstY];
|
||||||
if (ctl[0][B[lstX][lstY]] >= 4) {
|
if (ctl[0][B[lstX][lstY]] >= (N + 1) / 2) {
|
||||||
for (int i = 0; i < N; ++i) {
|
for (int i = 0; i < N; ++i) {
|
||||||
for (int j = 0; j < N; ++j) {
|
for (int j = 0; j < N; ++j) {
|
||||||
if (B[i][j] == t)
|
if (B[i][j] == t)
|
||||||
@ -40,7 +40,7 @@ std::tuple<int, int> getMove(int lstX, int lstY) {
|
|||||||
if (flag && B[i][j] != -1) {
|
if (flag && B[i][j] != -1) {
|
||||||
ctl[1][B[i][j]] += 1;
|
ctl[1][B[i][j]] += 1;
|
||||||
|
|
||||||
if (ctl[1][B[i][j]] >= 4) {
|
if (ctl[1][B[i][j]] >= (N + 1) / 2) {
|
||||||
int t = B[i][j];
|
int t = B[i][j];
|
||||||
for (int i = 0; i < N; ++i) {
|
for (int i = 0; i < N; ++i) {
|
||||||
for (int j = 0; j < N; ++j) {
|
for (int j = 0; j < N; ++j) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user