algorithm.c
changeset 25 b37843173279
parent 10 9148590f009d
child 26 95fccfcbd04c
equal deleted inserted replaced
24:bb3bb8584190 25:b37843173279
   451 		CopyMap(m, &maps[depth]);
   451 		CopyMap(m, &maps[depth]);
   452 		force_move_box(m, movements[i]);
   452 		force_move_box(m, movements[i]);
   453 		if (m->NumPlatforms == m->NumBoxesInPlatform)
   453 		if (m->NumPlatforms == m->NumBoxesInPlatform)
   454 		{
   454 		{
   455 			PrintMove(movements[i]);
   455 			PrintMove(movements[i]);
       
   456 			actual_map = &maps[depth+1];
       
   457 			show_percent_and_map();
   456 			return 0;
   458 			return 0;
   457 		}
   459 		}
   458 
   460 
   459 		if (is_new_map(maps, depth+1))
   461 		if (is_new_map(maps, depth+1))
   460 		{
   462 		{
   468 		{
   470 		{
   469 			percent_to_show = total_percent + next_percent*i;
   471 			percent_to_show = total_percent + next_percent*i;
   470 			depth_to_show = depth;
   472 			depth_to_show = depth;
   471 			actual_map = &maps[depth];
   473 			actual_map = &maps[depth];
   472 #ifdef DEBUG		/* to be out */
   474 #ifdef DEBUG		/* to be out */
   473 			show_percent_callback(0);
   475 			show_percent_and_map();
   474 #endif
   476 #endif
   475 	
   477 	
   476 		}
   478 		}
   477 		else
   479 		else
   478 		{
   480 		{
   481 				if(search_depth(maps, depth+1, new_movements,
   483 				if(search_depth(maps, depth+1, new_movements,
   482 					num_new_movements, next_percent,
   484 					num_new_movements, next_percent,
   483 					total_percent + next_percent*i) == 0)
   485 					total_percent + next_percent*i) == 0)
   484 				{
   486 				{
   485 					PrintMove(movements[i]);
   487 					PrintMove(movements[i]);
       
   488 					actual_map = &maps[depth+1];
       
   489 					show_percent_and_map();
   486 					return 0;
   490 					return 0;
   487 				}
   491 				}
   488 			}
   492 			}
   489 		}
   493 		}
   490 	}
   494 	}