diff options
author | Ian C <ianc@noddybox.co.uk> | 2011-05-05 07:40:08 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2011-05-05 07:40:08 +0000 |
commit | 2f66244d4d660570a0e7c391776f04d998643851 (patch) | |
tree | ce8805770f137d89be3ef6f67a8c94bb4bb769eb | |
parent | b1abd0e6d1800bd076b4b08f26bf411bd12b6ed8 (diff) |
Added checks to try and capture any hashing bugs.
-rw-r--r-- | dbox.c | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -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) |