From 2f66244d4d660570a0e7c391776f04d998643851 Mon Sep 17 00:00:00 2001 From: Ian C Date: Thu, 5 May 2011 07:40:08 +0000 Subject: Added checks to try and capture any hashing bugs. --- dbox.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/dbox.c b/dbox.c index 955d8b1..9cf8c96 100644 --- a/dbox.c +++ b/dbox.c @@ -851,6 +851,9 @@ static void SubSolve(const level_t *p_level, state_t *p_state, int p_depth, state_t *s; int ok; int f; + unsigned long long cache_size; + unsigned long long max_cache; + int warned; if (p_depth >= p_max_depth) { @@ -884,6 +887,16 @@ static void SubSolve(const level_t *p_level, state_t *p_state, int p_depth, first = NULL; curr = NULL; + cache_size = g_cached_states; + max_cache = cache_size * 4; + + if (max_cache < cache_size) + { + max_cache = 0xffffffffffffffffllu; + } + + warned = FALSE; + while(s) { /* Check to see whether the level is solved @@ -970,6 +983,19 @@ static void SubSolve(const level_t *p_level, state_t *p_state, int p_depth, SetChain(&first, &curr, new); s = s->next; + + if (g_cached_states < cache_size) + { + printf("WARNING: number of cached states has wrapped\n"); + cache_size = g_cached_states; + } + + if (!warned && g_cached_states > max_cache) + { + printf("WARNING: got over four times the number of " + "cached states at one depeth...\n"); + warned = TRUE; + } } if (first) -- cgit v1.2.3