diff --git a/TP1/C-Cpp/src/mysok.cpp b/TP1/C-Cpp/src/mysok.cpp index 4da83aa..8b5c9df 100644 --- a/TP1/C-Cpp/src/mysok.cpp +++ b/TP1/C-Cpp/src/mysok.cpp @@ -106,11 +106,13 @@ bool is_in_history(Node current, std::vector history) { int c = 0; for (int l = 0; l < NBL; ++l) { 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; } @@ -319,6 +321,9 @@ int dfs(Node &result, int depth, std::vector history) { sok_board_t next = result.state; // 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] == CRATE_ON_TARGET ? TARGET : FREE; // Déplacement caisse, nouvelle position