--- a/os.c Sun May 07 01:30:29 2006 +0200
+++ b/os.c Sun May 07 01:31:50 2006 +0200
@@ -123,18 +123,18 @@
}
#endif
- printf("Man is at (%i,%i)\n", Temp.Man.x, Temp.Man.y);
- printf("Platforms: %i, BoxesInPlatform: %i\n", Temp.NumPlatforms,
+ fprintf(stderr,"Man is at (%i,%i)\n", Temp.Man.x, Temp.Man.y);
+ fprintf(stderr,"Platforms: %i, BoxesInPlatform: %i\n", Temp.NumPlatforms,
Temp.NumBoxesInPlatform);
}
void PrintMove(const struct BoxMove b)
{
- printf("Box: %i, Direction: {%i,%i}\n", b.box, b.dir.x, b.dir.y);
+ fprintf(stderr,"Box: %i, Direction: {%i,%i}\n", b.box, b.dir.x, b.dir.y);
}
-static void show_percent_callback(const int parameter)
+void show_percent_and_map()
{
fprintf(stderr, "Percent: %2.12f, depth: %i-%i\n", percent_to_show,
min_depth_period, max_depth_period);
@@ -142,9 +142,12 @@
fflush(stderr);
min_depth_period = MAX_STEPS;
max_depth_period = 0;
-#ifndef DEBUG
+}
+
+static void show_percent_callback(const int parameter)
+{
+ show_percent_and_map();
alarm(ALARM_SECONDS);
-#endif
}
static void program_alarm()
@@ -164,5 +167,8 @@
void init_os()
{
+#ifndef DEBUG
program_alarm();
+#endif
}
+