示例#1
0
void splitHand(){
	if (2*bet<=chips){
		sleep(1.5);
		pad(5); printf("You chose to split your cards.\n");
		pad(10); printf("Starting First Split Hand:\n\n");
		playerSplit[0] = player[1]; //save second card
		pcount = player[0].val; 
		playerCardNum--;
		if (player[1].num=="A") aceP--;
		drawCard(0);
		showHand(0);
		cardCount(0);
		play();
		if (input!=0){ //if player didnt bust or blackjack
			playDealer();
			endRound();
		}
		pad(10); printf("Starting Second Split Hand:\n");
		player[0] = playerSplit[0];
		pcount=playerSplit[0].val; playerCardNum=1; ccount=0; dealerCardNum=0; //reset values
		drawCard(1);
		showHand(1);
		if (player[0].num=="A") aceP=1;
		else aceP=0;
		drawCard(0);
		showHand(0);
		drawCard(1);
		cardCount(0);
		play();
	}
	else{
		pad(5); printf("You do not have enough chips to split hand. Hit or Stay.\n\n");
	action();
	}
}
示例#2
0
int main(){
	setSeed(); //set random number seed
	beginGame(); //set chips=1000, print intro 
	shuffle();
	while (playing) {
		setup(); //shuffle deck, reset starting values
		makeBet(); //give initial bet amount
		dealBlackJack(); //deal player and dealer hands
		if (playerBlackjack()){ //check for player blackjack
			win();
			input=0;
		}
		else
			play(); //player plays Hand

		if (input!=0){ //if player didnt bust or blackjack
			playDealer();
			endRound();
		}

		if (playing) { 	//continue to next round
			pad(15); printf("Next Round...\n\n");
		}
	}
}
示例#3
0
static void gameOver(byte s)
{
	endRound();
	matrix.setLed(0, apple.y, apple.x, true); // In case the apple is off at that time
	strcpy_P(buffer, (char *) pgm_read_word(&(strings[GAME_OVER])));
	printLcd(3, 0, buffer);
	switch (s) {
		case 0:
			strcpy_P(buffer2, (char *) pgm_read_word(&(strings[PLAYER_WIN])));
			printLcd(0, 1, buffer2);
			printLcd(7, 1, "2");
			snake[1].score++;
			break;

		case 1:
			strcpy_P(buffer2, (char *) pgm_read_word(&(strings[PLAYER_WIN])));
			printLcd(0, 1, buffer2);
			printLcd(7, 1, "1");
			snake[0].score++;
			break;

		case 2:
			strcpy_P(buffer2, (char *) pgm_read_word(&(strings[TIE])));
			printLcd(4, 1, buffer2);
	}
	wipeMatrix();
	delay(500);
	newRound();
}
示例#4
0
static void newRound(void)
{
	endRound();

	snake[0].yDir = snake[1].yDir = 0;
	snake[0].length = snake[1].length = 3;
	snake[0].hasTurned = snake[1].hasTurned = false;
	
	snake[0].xDir = 1;
	snake[0].body.x[0] = 2;
	snake[0].body.y[0] = 1;
	snake[0].body.x[1] = 1;
	snake[0].body.y[1] = 1;
	snake[0].body.x[2] = 1;
	snake[0].body.y[2] = 2;

	snake[1].xDir = -1;
	snake[1].body.x[0] = 5;
	snake[1].body.y[0] = 6;
	snake[1].body.x[1] = 6;
	snake[1].body.y[1] = 6;
	snake[1].body.x[2] = 6;
	snake[1].body.y[2] = 5;

	generateApple();
	apple.on = false;
	secondSnakeOn = false;

	countdown(start, menu);
}
示例#5
0
    void Combat::jobFinished(unsigned long ticket)
	{
		if (ticket == mAnimationSequenceTicket)
		{
			endRound();
		}
	}
示例#6
0
static void gameOver(void)
{
	endRound();
	matrix.setLed(0, apple.y, apple.x, true); // In case the apple is off at that time
	strcpy_P(buffer, (char *) pgm_read_word(&(strings[GAME_OVER])));
	printLcd(3, 1, buffer);
	wipeMatrix();
	delay(500);
	newRound();
}
示例#7
0
void GameController::playCard () {
	if ( model_ -> canPlayCard () ) {
		// If the player can play this card, play it, and go to the next player
		model_ -> playCard ();
		model_ -> nextPlayer ();
		endRound();
		computerTurnLoop ();
	} else {
		// Otherwise throw exception
		throw IllegalPlayException ();
	}
}
示例#8
0
void GameController::computerTurnLoop () {
	// Keep looping as long as its a computer's turn
	while ( model_ -> currentPlayerIsComputer () ) {
		model_ -> takeTurnForCurrentPlayer ();
		model_ -> nextPlayer ();
		bool end = endRound();
		// Break if a winner is found
		if ( end ) {
			break;
		}
	}
}
示例#9
0
void GameController::discardCard () {
	if ( model_ -> canDiscardCard () ) {
		// If the player can discard the card, discard it, and go to the next player
		model_ -> discardCard ();
		model_ -> nextPlayer ();
		endRound();
		computerTurnLoop ();
	} else {
		// Otherwise throw exception
		throw IllegalDiscardException ();
	}
}
示例#10
0
文件: CSUEBomb.cpp 项目: narmour/CSUE
void ACSUEBomb::bombExplode() {
	UE_LOG(LogTemp, Warning, TEXT("EXPLODE"));
	if(explosionFX)
		UGameplayStatics::SpawnEmitterAtLocation(this, explosionFX, GetActorLocation());
	
	auto myGM = (ACSUEGameMode*)GetWorld()->GetAuthGameMode();
	if (myGM) {
		myGM->endRound(FString(TEXT("t")));
	}

	GetWorldTimerManager().ClearTimer(bombTimer);
	planted = false;
	



}
示例#11
0
static void newRound(void)
{
	endRound();

	snake.xDir = 1;
	snake.yDir = 0;
	snake.length = 3;
	snake.hasTurned = false;

	snake.body.x[0] = 2;
	snake.body.y[0] = 3;
	snake.body.x[1] = 1;
	snake.body.y[1] = 3;
	snake.body.x[2] = 1;
	snake.body.y[2] = 4;

	generateApple();
	apple.on = false;

	countdown(start, menu);
}
示例#12
0
文件: Game.cpp 项目: odanek/duel6r
 void Game::beforeClose(Context *nextContext) {
     endRound();
 }
示例#13
0
文件: Game.cpp 项目: odanek/duel6r
 void Game::nextRound() {
     endRound();
     startRound();
 }
示例#14
0
static void menu(byte data)
{
	endRound();
	showMenu();
}