Example #1
0
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");
}
Example #2
0
card drawscard(shoe *s) {
	card x;
	if(s->arr[s->deckno].index == 52)
		s->deckno++;
	x = drawcard(&(s->arr[s->deckno]));
	return x;
}
Example #3
0
/* give current player cards */
static int L_add_card(lua_State *L) {
	int i;
	CHECKARG(1); ISNUM(1);
	i=TONUM(1);
	if(i<0) error("%s: must draw nonnegative number of cards, not %d.\n",__func__+2,i);
	while(i--) drawcard(currentplayer);
	return 0;
}
Example #4
0
static bool gofish (enum EPlayer player, unsigned askedfor)
{
    wattron (_wmsg, A_BOLD);
    printplayer (OTHER(player));
    waddstr (_wmsg, "say \"GO FISH!\"\n");
    wattroff (_wmsg, A_BOLD);
    if (askedfor == drawcard (player)) {
	printplayer (player);
	waddstr (_wmsg, "drew the guess and get to ask again.\n");
	return true;
    }
    return false;
}
Example #5
0
int
gofish(int askedfor, int player, int *hand)
{
	printplayer(OTHER(player));
	(void)printf("say \"GO FISH!\"\n");
	if (askedfor == drawcard(player, hand)) {
		printplayer(player);
		(void)printf("drew the guess!\n");
		printplayer(player);
		(void)printf("get to ask again!\n");
		return(1);
	}
	return(0);
}