summaryrefslogtreecommitdiff
path: root/dbox.c
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2011-05-05 07:40:08 +0000
committerIan C <ianc@noddybox.co.uk>2011-05-05 07:40:08 +0000
commit2f66244d4d660570a0e7c391776f04d998643851 (patch)
treece8805770f137d89be3ef6f67a8c94bb4bb769eb /dbox.c
parentb1abd0e6d1800bd076b4b08f26bf411bd12b6ed8 (diff)
Added checks to try and capture any hashing bugs.
Diffstat (limited to 'dbox.c')
-rw-r--r--dbox.c26
1 files changed, 26 insertions, 0 deletions
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)