hihi
This commit is contained in:
parent
fc077eb86b
commit
94d9102b64
1 changed files with 7 additions and 2 deletions
|
@ -106,11 +106,13 @@ bool is_in_history(Node current, std::vector<Node> history) {
|
||||||
int c = 0;
|
int c = 0;
|
||||||
for (int l = 0; l < NBL; ++l) {
|
for (int l = 0; l < NBL; ++l) {
|
||||||
for (int m = 0; m < NBC; ++m) {
|
for (int m = 0; m < NBC; ++m) {
|
||||||
if (current.state.board[l][m] != current.state.board[l][m]) c++;
|
if (current.state.board[l][m] != current.state.board[l][m])
|
||||||
|
c++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == 0) return true;
|
if (c == 0)
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -319,6 +321,9 @@ int dfs(Node &result, int depth, std::vector<Node> history) {
|
||||||
sok_board_t next = result.state;
|
sok_board_t next = result.state;
|
||||||
|
|
||||||
// Déplacement caisse, ancienne position
|
// Déplacement caisse, ancienne position
|
||||||
|
if (next.board[cx][cy] == CRATE_ON_TARGET) {
|
||||||
|
++next.num_crates_free;
|
||||||
|
}
|
||||||
next.board[cx][cy] =
|
next.board[cx][cy] =
|
||||||
next.board[cx][cy] == CRATE_ON_TARGET ? TARGET : FREE;
|
next.board[cx][cy] == CRATE_ON_TARGET ? TARGET : FREE;
|
||||||
// Déplacement caisse, nouvelle position
|
// Déplacement caisse, nouvelle position
|
||||||
|
|
Reference in a new issue