> in interesting times as the Chinese curse goes...
*
+ * Debugging note: The command `x' causes the game to terminate and write
+ * a line consisting of the token `blue' followed by the random-number
+ * seed used for the game, followed by a list of the moves.
*/
#include <stdlib.h>
#define BASEROW 1
#define PROMPTROW 11
+static int seed, nmove;
+static char journal[PACK_SIZE];
+
static int deck_size = PACK_SIZE; /* initial deck */
static int deck[PACK_SIZE];
{
signal(onsig, SIG_IGN);
endwin();
+ if (seed)
+ printf("blue %d %s\n", seed, journal);
exit(0);
}
char c;
int select[4], card;
+ nmove = 0;
+ memset(journal, '\0', sizeof(journal));
while (dead<4)
{
dead=0;
clrtoeol();
(void) addch(' ');
} while
- (((c = getch())<'a' || c>'d') && (c!='r') && (c!='q'));
+ (!(c = getch()) || !strchr("abcdqrx", c));
}
for (j = 0; j < 4; j++)
}
if (c == 'r')
+ {
+ clearok(stdscr, TRUE);
display_cards(deal_number);
+ }
+ else if (c == 'x')
+ die(0);
else if (c == 'q')
+ {
+ seed = 0;
die(0);
+ }
else
{
i = c-'a';
freeptr[i]=select[i];
}
}
+ journal[nmove++] = c;
}
}
cbreak();
if (argc == 2)
- srand(atoi(argv[1]));
+ srand(seed = atoi(argv[1]));
else
- srand((int)time((long *)0));
+ srand(seed = (int)time((long *)0));
init_vars();