Esempio n. 1
0
void AllZombies::addZombie(int row, int type)
{
    if (!type)
        qDebug()<<"unknown type of zombie!";
    Zombie* z;
    switch(type){
        case 1:
            z =new Zombie(f);
            break;
        case 2:
            z = new ConeheadZombie(f);
            break;
        case 3:
            z = new BucketheadZombie(f);
            break;
        default:
            z = new Zombie(f);
    }
    connect(z,SIGNAL(die(Zombie*)),this,SLOT(killDead(Zombie*)));
    connect(this,SIGNAL(receiveHit(Zombie*,int,int)),z,SLOT(hitten(Zombie*,int,int)),Qt::QueuedConnection);
    connect(this,SIGNAL(pauseAllZombies()),z,SLOT(pause()));
    connect(this,SIGNAL(restoreAllZombies()),z,SLOT(restore()));
    connect(z,SIGNAL(youLose()),this,SIGNAL(youLose()));
    zombieList[row].push_back(z);
    // qDebug()<<"come to AllZombies::addZombie";
    emit addZombieAt(z,row,MAX_COL);
}
Esempio n. 2
0
File: nim.c Progetto: ppenna/nanvix
int main()
{
	setvbuf(stdout, NULL, _IONBF, BUFSIZ);
	int option;

	nBin[0] = 0;
	nBin[1] = 1;
	nBin[2] = 10;
	nBin[3] = 11;
	nBin[4] = 100;
	nBin[5] = 101;
	nBin[6] = 110;
	nBin[7] = 111;
	nBin[8] = 1000;

	title();

	printf("\n\nEste jogo consiste em retirar os \"palitos\", sendo que voce"
		" pode remover quantos palitos quiser de uma unica fileira, e, quem"
		" remover o ultimo palito, perde:\n\n");

	draw();

	printf("Quem comeca, computador:1, voce:2 ? ");
	option = get() - 48;
	turn = option;

	while(sticksCount > 0)
		think();

	if(turn == COMPUTER)
		youLose();
	else if(turn == PLAYER)
		youWin();

	return 0;
}