/*
* guess.d - guessing game in D (DTrace)
*
* $Id: guess.d 32 2007-09-15 05:08:49Z brendan $
*
* USAGE: guess.d
*
*
* This is written to demonstrate this language versus the same program
* written in other languages.
*
* 11-May-2005 Brendan Gregg Created this.
*/
{
printf("guess.d - Guess a number between 1 and 100\n\n");
num = 1;
state = 1;
/* Generate random number */
}
{
state = 2;
system("read guess");
pos = 0;
}
{
}
{
pos++;
}
{
pos -= 2;
fac = 1;
pos--;
fac *= 10;
pos--;
fac *= 10;
}
{
}
/* Play game */
{
state = 3;
printf("Please enter your name: ");
}
{
num++;
system("read line");
pos = 0;
}
{
}
/* Save high score */
{
/* Print high scores */
printf("\nPrevious high scores,\n");
exit(0);
}