diff -r b37843173279 -r 95fccfcbd04c algorithm.c --- a/algorithm.c Sun May 07 13:34:25 2006 +0200 +++ b/algorithm.c Fri Feb 16 22:57:36 2007 +0100 @@ -496,13 +496,16 @@ } -int solve_map(const struct Map origin) +int solve_map(const struct Map *origin) { - struct Map maps[MAX_STEPS+1]; + struct Map *maps; struct BoxMove new_movements[MAX_MOVES]; int num_new_movements; + int ret; - CopyMap(&maps[0], &origin); + maps = malloc(sizeof(*maps) * (MAX_STEPS+1)); + + CopyMap(&maps[0], origin); num_new_movements = get_box_movements(&maps[0], new_movements); assert(num_new_movements < MAX_MOVES); @@ -510,8 +513,9 @@ init_os(); - return search_depth(maps, 0, new_movements, + ret = search_depth(maps, 0, new_movements, num_new_movements, 100. / num_new_movements, 0); - + free(maps); + return ret; }