From 94d9102b64209f03bbcdbbcf7d04058b25bca782 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Tue, 21 Feb 2023 14:20:03 +0100 Subject: [PATCH] hihi --- TP1/C-Cpp/src/mysok.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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