Ejemplo n.º 1
0
int main()
{
    int bins[5];
    int turns = 1;;
    int i = 0;
    for(i = 0; i < 5; i++)
    {
        bins[i] = 7;
    }
    int matchesRemoved;
    int binNumber;
    while(checkGameEnd(bins, 5) == false)
    {
        displayGame(bins, 5);
        if(turns % 2 == 0)
        {
            printf("It is Player 2's turn\n");
        }
        else
        {
            printf("It is Player 1's turn\n");
        }
        printf("What bin do you want to remove matches from? (1-5)\n");
        scanf(" %d", &binNumber);
        binNumber -= 1;
        printf("How many matches do you want to remove? (1-7)\n");
        scanf(" %d", &matchesRemoved);
        if(removeMatches(binNumber, matchesRemoved, bins, 5) == false)
        {
            printf("Try again, please enter a legal move.\n");
            turns -= 1;
        }
        turns++;
    }
    if(turns % 2 == 0)
    {
        printf("Player 2 wins!\n");
    }
    else
    {
        printf("Player 1 wins!\n");
    }
}
Ejemplo n.º 2
0
	void GameScene::update(float dt)
	{
		float playTime = currentTime() - mStartTime; // - origTime ??
		float position = mLastBpmMeter + calculateMeter(mCurrentBpm, currentTime() - mLastBpmTime);
		if( checkGameEnd() )
		{
			gameEnd();
			return;
		}

		for(auto it = mChannelPlayers.begin(); it != mChannelPlayers.end(); it++)
		{
			if (it->second)
			{
				// invisible note
				if (it->first[0] == '3' || it->first[0] == '4')
					continue;

				it->second->autoplay(position);
			}
		}
	}