/* Some c functions that allow dramatic delays for the lunar lander game
 * Copyright (c) 2000, GPL
 * written by Douglas M. Auclair, dauclair@hotmail.com */

#include "counter.h"
#include <stdio.h>

static void print_number(int x)
{
  if(x < 10) printf("0");
  printf("%d",x);
  fflush(stdout);
  wait_seconds(1);
  printf("\b\b");
  fflush(stdout);
}
  
void countdown()
{
  int x = 10;
  printf("-- COUNTDOWN: ");
  for(; x >= 0; x--) print_number(x);
  printf("\n\nYou have left the spacecraft.\nTry to land "
	 "with the velocity less than 5 m/sec.\n");
}

void wait_seconds(int x) { sleep(x); }

