コード例 #1
0
ファイル: rules.c プロジェクト: stubbscroll/CARDGAME
static void playgame() {
	int i,j;
	for(i=0;i<players;i++) for(j=0;j<5;j++) drawcard(i);
	while(1) {
		cur=&player[currentplayer];
		puts("===============================================================================");
		printf("player %d plays and has",currentplayer);
		resetplayerturn(currentplayer);
		for(i=0;i<cur->handn;i++) printf(" %s",card[cur->hand[i]].fullname);
		putchar('\n');
		puts("action phase!");
		actionphase();
		puts("buy phase!");
		printf("player has %d actions, %d money, %d buys, %d potions\n",cur->action,cur->money,cur->buy,cur->potion);
		buyphase();
		/* toss play area into discard */
		/* TODO heed cards that has effect when moving to discard, such as
		   walled's village. remember that throne room, king's court and procession
		   count as one action each for walled village */
		while(cur->playarean) movepile(cur->playarea,&cur->playarean,cur->discard,&cur->discardn);
		/* toss hand into discard */
		while(cur->handn) movepile(cur->hand,&cur->handn,cur->discard,&cur->discardn);
		/* draw 5 new cards */
		for(i=0;i<5;i++) drawcard(currentplayer);
		currentplayer=(currentplayer+1)%players;
	}
	dumpcards();
	dumpgroups();
	dumppiles();
	puts("whee game over");
}
コード例 #2
0
ファイル: nntpfs.c プロジェクト: dancrossnyc/harvey
void
dumpgroups(Group *g, int ind)
{
	int i;

	print("%*s%s\n", ind*4, "", g->name);
	for(i=0; i<g->nkid; i++)
		dumpgroups(g->kid[i], ind+1);
}