Still working on updating code to new poker code.
This commit is contained in:
@ -1,68 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "round.h"
|
||||
|
||||
void _pokerActionRoundOnStart(queue_t *queue, queueaction_t *action ,uint8_t i){
|
||||
uint8_t j, indexDealer, indexSmallBlind, indexBigBlind;
|
||||
bool foundDealer, foundSmallBlind;
|
||||
pokerplayer_t *player;
|
||||
poker_t *poker;
|
||||
|
||||
poker = (poker_t *)action->data;
|
||||
|
||||
// Update game state.
|
||||
poker->state = POKER_STATE_STARTING_ROUND;
|
||||
|
||||
// Prepare the initial game state
|
||||
pokerBetReset(&poker->bet);
|
||||
pokerDealerInit(&poker->dealer);
|
||||
|
||||
// Reset the players
|
||||
for(i = 0; i < POKER_PLAYER_COUNT; i++) {
|
||||
pokerPlayerReset(poker->players + i);
|
||||
}
|
||||
|
||||
// Decide on the dealer
|
||||
poker->roundDealer = (poker->roundDealer+1) % POKER_PLAYER_COUNT;
|
||||
|
||||
// Find (and kill) the players.
|
||||
j = poker->roundDealer;
|
||||
foundDealer = false;
|
||||
foundSmallBlind = false;
|
||||
while(true) {
|
||||
player = poker->players + j;
|
||||
|
||||
if(!pokerPlayerIsInRound(player)) continue;
|
||||
if(!foundDealer) {
|
||||
indexDealer = j;
|
||||
foundDealer = true;
|
||||
} else if(!foundSmallBlind) {
|
||||
indexSmallBlind = j;
|
||||
foundSmallBlind = true;
|
||||
} else {
|
||||
indexBigBlind = j;
|
||||
break;
|
||||
}
|
||||
j = (j + 1) % POKER_PLAYER_COUNT;
|
||||
}
|
||||
|
||||
// Update players for the round.
|
||||
poker->roundDealer = indexDealer;
|
||||
poker->roundBigBlind = indexBigBlind;
|
||||
poker->roundSmallBlind = indexSmallBlind;
|
||||
|
||||
queueNext(queue);
|
||||
}
|
||||
|
||||
queueaction_t * pokerActionRoundAdd(queue_t *queue, poker_t *poker) {
|
||||
queueaction_t *action;
|
||||
action = queueAdd(queue);
|
||||
action->data = (void *)poker;
|
||||
action->onStart = &_pokerActionRoundOnStart;
|
||||
return action;
|
||||
}
|
@ -13,46 +13,47 @@ void _pokerGameActionBetOnStart(
|
||||
bool isHuman;
|
||||
pokergame_t *game = (pokergame_t *)action->data;
|
||||
|
||||
//TODO: Fix this whole filee
|
||||
// Reset the UI state.
|
||||
isHuman = game->poker.bet.better == POKER_PLAYER_HUMAN_INDEX;
|
||||
if(isHuman) pokerUiBetShow(&game->ui);
|
||||
// isHuman = game->poker.bet.better == POKER_PLAYER_HUMAN_INDEX;
|
||||
// if(isHuman) pokerUiBetShow(&game->ui);
|
||||
}
|
||||
|
||||
void _pokerGameActionBetOnUpdate(
|
||||
queue_t *queue, queueaction_t *action, uint8_t i
|
||||
) {
|
||||
// Restack
|
||||
bool isHuman;
|
||||
bool turnMade = false;
|
||||
pokerturn_t turn;
|
||||
pokergame_t *game = (pokergame_t *)action->data;
|
||||
pokerplayer_t *player;
|
||||
pokerdiscussiondata_t discussion;
|
||||
// bool isHuman;
|
||||
// bool turnMade = false;
|
||||
// pokerturn_t turn;
|
||||
// pokergame_t *game = (pokergame_t *)action->data;
|
||||
// pokerplayer_t *player;
|
||||
// pokerdiscussiondata_t discussion;
|
||||
|
||||
// Are they human?
|
||||
player = game->poker.players + game->poker.bet.better;
|
||||
isHuman = game->poker.bet.better == POKER_PLAYER_HUMAN_INDEX;
|
||||
// // Are they human?
|
||||
// player = game->poker.players + game->poker.bet.better;
|
||||
// isHuman = game->poker.bet.better == POKER_PLAYER_HUMAN_INDEX;
|
||||
|
||||
// Handle as an AI
|
||||
if(isHuman) {
|
||||
turn = game->ui.betTurn;
|
||||
turnMade = game->ui.betTurnMade;
|
||||
} else {
|
||||
turn = pokerTurnGet(&game->poker, game->poker.bet.better);
|
||||
turnMade = true;
|
||||
}
|
||||
// // Handle as an AI
|
||||
// if(isHuman) {
|
||||
// turn = game->ui.betTurn;
|
||||
// turnMade = game->ui.betTurnMade;
|
||||
// } else {
|
||||
// turn = pokerTurnGet(&game->poker, game->poker.bet.better);
|
||||
// turnMade = true;
|
||||
// }
|
||||
|
||||
// Now decide if we should do something.
|
||||
if(!turnMade) return;
|
||||
// // Now decide if we should do something.
|
||||
// if(!turnMade) return;
|
||||
|
||||
// Perform the action
|
||||
pokerTurnAction(&game->poker, player, &turn);
|
||||
// // Perform the action
|
||||
// pokerTurnAction(&game->poker, player, &turn);
|
||||
|
||||
// Speak
|
||||
discussion.reason = pokerDiscussionGetTypeFromTurnType(turn.type);
|
||||
discussion.poker = game;
|
||||
discussion.playerCause = game->poker.bet.better;
|
||||
pokerDiscussionQueue(&discussion);
|
||||
// // Speak
|
||||
// discussion.reason = pokerDiscussionGetTypeFromTurnType(turn.type);
|
||||
// discussion.poker = game;
|
||||
// discussion.playerCause = game->poker.bet.better;
|
||||
// pokerDiscussionQueue(&discussion);
|
||||
|
||||
// Next.
|
||||
queueNext(queue);
|
||||
@ -63,20 +64,20 @@ void _pokerGameActionBetOnEnd(
|
||||
) {
|
||||
pokergame_t *game = (pokergame_t *)action->data;
|
||||
|
||||
// Get which player is remaining to move.
|
||||
game->poker.bet.better = pokerBetGetRemainingPlayer(
|
||||
&game->poker.bet, game->poker.players, game->poker.roundSmallBlind
|
||||
);
|
||||
// // Get which player is remaining to move.
|
||||
// game->poker.bet.better = pokerBetGetRemainingPlayer(
|
||||
// &game->poker.bet, game->poker.players, game->poker.roundSmallBlind
|
||||
// );
|
||||
|
||||
// Restack
|
||||
pokerGameActionRestackAdd(game);
|
||||
// // Restack
|
||||
// pokerGameActionRestackAdd(game);
|
||||
|
||||
// Are we waiting on any players?
|
||||
if(game->poker.bet.better != 0xFF) {
|
||||
pokerGameActionLookAdd(game, game->poker.bet.better);
|
||||
pokerGameActionBetAdd(game);
|
||||
return;
|
||||
}
|
||||
// // Are we waiting on any players?
|
||||
// if(game->poker.bet.better != 0xFF) {
|
||||
// pokerGameActionLookAdd(game, game->poker.bet.better);
|
||||
// pokerGameActionBetAdd(game);
|
||||
// return;
|
||||
// }
|
||||
|
||||
// Not waiting, do next action.
|
||||
pokerGameActionFlopAdd(game);
|
||||
|
@ -18,9 +18,9 @@ void _pokerGameActionFlopOnStart(
|
||||
discussion.poker = game;
|
||||
|
||||
// Get how many players are left in the round.
|
||||
if(pokerPlayerGetCountInRound(game->poker.players) > 1) {// Still more than 1
|
||||
if(pokerInRoundGetCount(game->poker.players) > 1) {// Still more than 1
|
||||
// Add the actual flop action.
|
||||
next = pokerActionNextFlopAdd(queue, &game->poker);
|
||||
// next = pokerActionNextFlopAdd(queue, &game->poker);
|
||||
|
||||
// Reset all the players
|
||||
|
||||
@ -30,23 +30,21 @@ void _pokerGameActionFlopOnStart(
|
||||
discussion.reason = POKER_DISCUSSION_REASON_FLOP;
|
||||
pokerDiscussionQueue(&discussion);
|
||||
|
||||
// Reset the better to the betting round initial.
|
||||
pokerBetResetBetter(
|
||||
&game->poker.bet, game->poker.players, game->poker.roundSmallBlind
|
||||
);
|
||||
// //TODO: Get the next player here.
|
||||
// pokerPlayerGetRemainingBetter(&poker);
|
||||
|
||||
// Now, get the count of players left to bet. If "everyone is all in" then
|
||||
// this will be 0 and no actual betting needs to happen.
|
||||
if(pokerBetGetRemainingPlayerCount(
|
||||
&game->poker.bet, game->poker.players
|
||||
) > 1) {
|
||||
// Begin betting.
|
||||
pokerGameActionLookAdd(game, game->poker.bet.better);
|
||||
pokerGameActionBetAdd(game);
|
||||
} else {
|
||||
//No actual players to bet, so add the following flop instead.
|
||||
pokerGameActionFlopAdd(game);
|
||||
}
|
||||
// // Now, get the count of players left to bet. If "everyone is all in" then
|
||||
// // this will be 0 and no actual betting needs to happen.
|
||||
// if(pokerBetGetRemainingPlayerCount(
|
||||
// &game->poker.bet, game->poker.players
|
||||
// ) > 1) {
|
||||
// // Begin betting.
|
||||
// pokerGameActionLookAdd(game, game->poker.bet.better);
|
||||
// pokerGameActionBetAdd(game);
|
||||
// } else {
|
||||
// //No actual players to bet, so add the following flop instead.
|
||||
// pokerGameActionFlopAdd(game);
|
||||
// }
|
||||
|
||||
// Do next action.
|
||||
queueNext(queue);
|
||||
|
@ -41,9 +41,11 @@ void _pokerGameActionRoundOnEnd(queue_t *queue,queueaction_t *action,uint8_t i){
|
||||
|
||||
// Begin Betting Round. This will queue for one player only and then the round
|
||||
// will take over.
|
||||
pokerBetResetBetter(
|
||||
&game->poker.bet, game->poker.players, game->poker.roundSmallBlind
|
||||
);
|
||||
|
||||
// TODO: finish
|
||||
// pokerBetResetBetter(
|
||||
// &game->poker.bet, game->poker.players, game->poker.roundSmallBlind
|
||||
// );
|
||||
pokerGameActionBetAdd(game);
|
||||
}
|
||||
|
||||
|
@ -17,9 +17,6 @@ void _pokerGameActionStartOnEnd(queue_t *queue,queueaction_t *action,uint8_t i){
|
||||
pokerdiscussiondata_t data;
|
||||
pokergame_t *game = (pokergame_t *)action->data;
|
||||
|
||||
// Begin the match
|
||||
pokerInit(&game->poker);
|
||||
|
||||
// Say that.
|
||||
data.poker = game;
|
||||
data.reason = POKER_DISCUSSION_REASON_MATCH_START;
|
||||
|
@ -14,14 +14,15 @@ void _pokerGameActionWinnerOnStart(
|
||||
pokergame_t *game = (pokergame_t *)action->data;
|
||||
|
||||
// Calculate the winners
|
||||
pokerWinnerCalculate(
|
||||
&game->poker.winner,
|
||||
&game->poker.dealer,
|
||||
game->poker.players
|
||||
);
|
||||
// TODO: Calculate Winners
|
||||
// pokerWinnerCalculate(
|
||||
// &game->poker.winner,
|
||||
// &game->poker.dealer,
|
||||
// game->poker.players
|
||||
// );
|
||||
|
||||
// Action
|
||||
pokerGameWin(&game->poker);
|
||||
// pokerGameWin(&game->poker);
|
||||
|
||||
// Say stuff
|
||||
discussion.reason = POKER_DISCUSSION_REASON_BETTING_DONE;
|
||||
|
@ -10,13 +10,12 @@
|
||||
void _pokerActionBlindsOnStart(queue_t *queue,queueaction_t *action,uint8_t i) {
|
||||
poker_t *poker;
|
||||
poker = (poker_t *)action->data;
|
||||
poker->state = POKER_STATE_TAKING_BLINDS;
|
||||
pokerBetTakeBlinds(
|
||||
&poker->bet,
|
||||
poker->players,
|
||||
poker->roundSmallBlind,
|
||||
poker->roundBigBlind
|
||||
);
|
||||
|
||||
// TODO: Fix State
|
||||
// poker->state = POKER_STATE_TAKING_BLINDS;
|
||||
// TODO: Fix Blinds
|
||||
// pokerTakeBlinds(&poker, poker->blindSmall, poker->blindBig);
|
||||
|
||||
printf("Taken Blinds\n");
|
||||
queueNext(queue);
|
||||
}
|
@ -6,7 +6,6 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "../bet.h"
|
||||
#include "../poker.h"
|
||||
#include "../../libs.h"
|
||||
#include "../../display/animation/queue.h"
|
@ -11,13 +11,13 @@ void _pokerActionDealOnStart(queue_t *queue, queueaction_t *action, uint8_t i) {
|
||||
poker_t *poker;
|
||||
poker = (poker_t *)action->data;
|
||||
|
||||
|
||||
// Shuffle the deck
|
||||
poker->state = POKER_STATE_DEALING;
|
||||
cardShuffle(poker->dealer.deck, CARD_DECK_SIZE);
|
||||
// TODO: State yknow
|
||||
// poker->state = POKER_STATE_DEALING;
|
||||
cardShuffle(poker->deck, CARD_DECK_SIZE);
|
||||
|
||||
// Deal 2 card to each player
|
||||
pokerDealerDealAll(&poker->dealer, poker->players, POKER_DEAL_CARD_EACH);
|
||||
pokerPlayerDealAll(poker, POKER_PLAYER_HAND_SIZE_MAX);
|
||||
queueNext(queue);
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
#pragma once
|
||||
#include "../../libs.h"
|
||||
#include "../../display/animation/queue.h"
|
||||
#include "../dealer.h"
|
||||
#include "../poker.h"
|
||||
|
||||
/** Callback for the deal action */
|
@ -11,10 +11,10 @@ void _pokerActionFlopDo(queue_t *queue, queueaction_t *action, uint8_t count) {
|
||||
poker_t *poker;
|
||||
poker = (poker_t *)action->data;
|
||||
|
||||
poker->state = POKER_STATE_CARDS_FLOPPING;
|
||||
|
||||
pokerDealerBurn(&poker->dealer, POKER_FLOP_BURN_COUNT);
|
||||
pokerDealerTurn(&poker->dealer, count);
|
||||
// TODO: Fix State
|
||||
// poker->state = POKER_STATE_CARDS_FLOPPING;
|
||||
pokerBurn(&poker, POKER_FLOP_BURN_COUNT);
|
||||
pokerTurn(&poker, count);
|
||||
|
||||
printf("Turned %u cards\n", count);
|
||||
queueNext(queue);
|
||||
@ -57,17 +57,19 @@ queueaction_t * pokerActionRiverAdd(queue_t *queue, poker_t *poker) {
|
||||
}
|
||||
|
||||
queueaction_t * pokerActionNextFlopAdd(queue_t *queue, poker_t *poker) {
|
||||
switch(poker->dealer.cardsFacing) {
|
||||
case 0:
|
||||
return pokerActionFlopAdd(queue, poker);
|
||||
// switch(poker->dealer.cardsFacing) {
|
||||
// case 0:
|
||||
// return pokerActionFlopAdd(queue, poker);
|
||||
|
||||
case POKER_FLOP_CARD_COUNT:
|
||||
return pokerActionTurnAdd(queue, poker);
|
||||
// case POKER_FLOP_CARD_COUNT:
|
||||
// return pokerActionTurnAdd(queue, poker);
|
||||
|
||||
case POKER_FLOP_CARD_COUNT+POKER_TURN_CARD_COUNT:
|
||||
return pokerActionRiverAdd(queue, poker);
|
||||
// case POKER_FLOP_CARD_COUNT+POKER_TURN_CARD_COUNT:
|
||||
// return pokerActionRiverAdd(queue, poker);
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
// default:
|
||||
// return NULL;
|
||||
// }
|
||||
|
||||
return NULL;
|
||||
}
|
@ -8,9 +8,7 @@
|
||||
#pragma once
|
||||
#include "../../libs.h"
|
||||
#include "../../display/animation/queue.h"
|
||||
#include "../dealer.h"
|
||||
#include "../poker.h"
|
||||
#include "../turn.h"
|
||||
|
||||
/** How many cards the dealer should burn before dealing the flop */
|
||||
#define POKER_FLOP_BURN_COUNT 1
|
@ -13,17 +13,14 @@ void _pokerActionMatchOnStart(queue_t *queue, queueaction_t *action, uint8_t i){
|
||||
|
||||
poker = (poker_t *)action->data;
|
||||
|
||||
poker->state = POKER_STATE_STARTING_MATCH;
|
||||
// TODO: Fix state
|
||||
// poker->state = POKER_STATE_STARTING_MATCH;
|
||||
|
||||
// Reset the main game state. This does not init the round.
|
||||
pokerBetInit(&poker->bet);
|
||||
poker->roundDealer = POKER_PLAYER_COUNT-2;
|
||||
// Reset the main game state. This will also init the round.
|
||||
pokerInit(&poker);
|
||||
|
||||
//TODO: Add Players here
|
||||
|
||||
// Reset the players
|
||||
for(x = 0; x < POKER_PLAYER_COUNT; x++) {
|
||||
poker->players[x].state = 0x00;
|
||||
poker->players[x].chips = POKER_BET_PLAYER_CHIPS_DEFAULT;
|
||||
}
|
||||
queueNext(queue);
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
#pragma once
|
||||
#include "../../libs.h"
|
||||
#include "../../display/animation/queue.h"
|
||||
#include "../bet.h"
|
||||
#include "../poker.h"
|
||||
|
||||
/** Callback for when the poker match aciton starts */
|
36
src/poker/actions/round.c
Normal file
36
src/poker/actions/round.c
Normal file
@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "round.h"
|
||||
|
||||
void _pokerActionRoundOnStart(queue_t *queue, queueaction_t *action ,uint8_t i){
|
||||
uint8_t j, indexDealer, indexSmallBlind, indexBigBlind;
|
||||
bool foundDealer, foundSmallBlind;
|
||||
pokerplayer_t *player;
|
||||
poker_t *poker;
|
||||
|
||||
poker = (poker_t *)action->data;
|
||||
|
||||
// TODO: Fix State
|
||||
// poker->state = POKER_STATE_STARTING_ROUND;
|
||||
|
||||
// Prepare the initial game stat
|
||||
pokerResetRound(&poker);
|
||||
|
||||
// Decide on the dealer
|
||||
pokerNewDealer(&poker);
|
||||
|
||||
queueNext(queue);
|
||||
}
|
||||
|
||||
queueaction_t * pokerActionRoundAdd(queue_t *queue, poker_t *poker) {
|
||||
queueaction_t *action;
|
||||
action = queueAdd(queue);
|
||||
action->data = (void *)poker;
|
||||
action->onStart = &_pokerActionRoundOnStart;
|
||||
return action;
|
||||
}
|
@ -8,9 +8,6 @@
|
||||
#pragma once
|
||||
#include "../../libs.h"
|
||||
#include "../../display/animation/queue.h"
|
||||
#include "../dealer.h"
|
||||
#include "../bet.h"
|
||||
#include "../player.h"
|
||||
#include "../poker.h"
|
||||
|
||||
/** Callback for when the poker round start aciton begins. */
|
@ -192,6 +192,22 @@ int32_t pokerPlayerGetCallBet(poker_t *poker, pokerplayer_t *player) {
|
||||
return pokerGetCallValue(poker) - player->currentBet;
|
||||
}
|
||||
|
||||
uint8_t pokerInRoundGetCount(poker_t *poker) {
|
||||
uint8_t i, count;
|
||||
pokerplayer_t *player;
|
||||
|
||||
count = 0;
|
||||
for(i = 0; i < poker->playerCount; i++) {
|
||||
player = poker->players + i;
|
||||
if(player->state & (POKER_PLAYER_STATE_FOLDED | POKER_PLAYER_STATE_OUT)) {
|
||||
continue;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
// Betting
|
||||
void pokerPlayerBetPot(
|
||||
poker_t *poker, pokerpot_t *pot, uint8_t playerIndex, int32_t chips
|
||||
|
@ -85,6 +85,11 @@
|
||||
/** The default blind cost for the small blind. (Defaults half big blind) */
|
||||
#define POKER_BET_BLIND_SMALL_DEFAULT (POKER_BET_BLIND_BIG_DEFAULT/2)
|
||||
|
||||
/** How many cards are dealt for the flop, turn and river */
|
||||
#define POKER_FLOP_CARD_COUNT 3
|
||||
#define POKER_TURN_CARD_COUNT 1
|
||||
#define POKER_RIVER_CARD_COUNT 1
|
||||
|
||||
typedef struct {
|
||||
/** Count of chips the player has */
|
||||
int32_t chips;
|
||||
@ -317,6 +322,13 @@ uint8_t pokerPlayerGetNextBetter(poker_t *poker, uint8_t current);
|
||||
*/
|
||||
int32_t pokerPlayerGetCallBet(poker_t *poker, pokerplayer_t *player);
|
||||
|
||||
/**
|
||||
* Gets the count of players still currently left in the round.
|
||||
*
|
||||
* @param poker Poker game instance.
|
||||
* @return The count of players in the round.
|
||||
*/
|
||||
uint8_t pokerInRoundGetCount(poker_t *poker);
|
||||
|
||||
/**
|
||||
* Let a player bet chips into the pot.
|
||||
|
@ -60,10 +60,6 @@ void test_pokerResetRound_should_ResetThePlayers(void) {
|
||||
POKER_PLAYER_STATE_HAS_BET_THIS_ROUND, poker.players[i].state
|
||||
);
|
||||
TEST_ASSERT_BITS_LOW(POKER_PLAYER_STATE_SHOWING, poker.players[i].state);
|
||||
TEST_ASSERT_EQUAL_UINT8(
|
||||
0xFF - POKER_PLAYER_STATE_FOLDED - POKER_PLAYER_STATE_HAS_BET_THIS_ROUND,
|
||||
poker.players[i].state
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -677,6 +673,32 @@ void test_pokerPlayerGetCallBet_should_GetCallBet(void) {
|
||||
TEST_ASSERT_EQUAL_INT32(0, pokerPlayerGetCallBet(&poker,poker.players+p2));
|
||||
}
|
||||
|
||||
void test_pokerInRoundGetCount(void) {
|
||||
poker_t poker;
|
||||
uint8_t p0, p1, p2;
|
||||
|
||||
pokerInit(&poker);
|
||||
p0 = pokerPlayerAdd(&poker);
|
||||
p1 = pokerPlayerAdd(&poker);
|
||||
p2 = pokerPlayerAdd(&poker);
|
||||
|
||||
TEST_ASSERT_EQUAL_UINT8(0x00, pokerInRoundGetCount(&poker));
|
||||
|
||||
pokerPlayerChipsAdd(poker.players + p0, 10000);
|
||||
TEST_ASSERT_EQUAL_UINT8(0x01, pokerInRoundGetCount(&poker));
|
||||
pokerPlayerChipsAdd(poker.players + p1, 10000);
|
||||
TEST_ASSERT_EQUAL_UINT8(0x02, pokerInRoundGetCount(&poker));
|
||||
pokerPlayerChipsAdd(poker.players + p2, 10000);
|
||||
TEST_ASSERT_EQUAL_UINT8(0x03, pokerInRoundGetCount(&poker));
|
||||
|
||||
poker.players[0].state |= POKER_PLAYER_STATE_FOLDED;
|
||||
TEST_ASSERT_EQUAL_UINT8(0x02, pokerInRoundGetCount(&poker));
|
||||
poker.players[1].state |= POKER_PLAYER_STATE_FOLDED;
|
||||
TEST_ASSERT_EQUAL_UINT8(0x01, pokerInRoundGetCount(&poker));
|
||||
poker.players[2].state |= POKER_PLAYER_STATE_OUT;
|
||||
TEST_ASSERT_EQUAL_UINT8(0x00, pokerInRoundGetCount(&poker));
|
||||
}
|
||||
|
||||
void test_pokerPlayerBetPot_should_AddChipsToThePot(void) {
|
||||
poker_t poker;
|
||||
pokerpot_t *pot;
|
||||
@ -1418,7 +1440,6 @@ void test_pokerWinnerDetermine_should_DecideTheWinnerCorrectly(void) {
|
||||
TEST_ASSERT_EQUAL_UINT8(1, participants[1]);
|
||||
}
|
||||
|
||||
|
||||
int test_poker() {
|
||||
UNITY_BEGIN();
|
||||
|
||||
@ -1448,6 +1469,7 @@ int test_poker() {
|
||||
RUN_TEST(test_pokerPlayerGetRemainingBetter_should_ReturnRemainingBetters);
|
||||
RUN_TEST(test_pokerPlayerGetNextBetter_should_GetTheNextBetter);
|
||||
RUN_TEST(test_pokerPlayerGetCallBet_should_GetCallBet);
|
||||
RUN_TEST(test_pokerInRoundGetCount);
|
||||
RUN_TEST(test_pokerPlayerBetPot_should_AddChipsToThePot);
|
||||
RUN_TEST(test_pokerPlayerBetPot_should_UpdatePlayerState);
|
||||
RUN_TEST(test_pokerPlayerBet_should_BetToTheActivePot);
|
||||
|
@ -5,6 +5,6 @@
|
||||
|
||||
#pragma once
|
||||
#include <unity.h>
|
||||
#include <poker2/poker.h>
|
||||
#include <poker/poker.h>
|
||||
|
||||
int test_poker2();
|
||||
int test_poker();
|
@ -6,11 +6,11 @@
|
||||
*/
|
||||
|
||||
#include "poker/card.h"
|
||||
#include "poker2/poker.h"
|
||||
#include "poker/poker.h"
|
||||
|
||||
int main() {
|
||||
return (
|
||||
test_card() ||
|
||||
test_poker2()
|
||||
test_poker()
|
||||
) || 0;
|
||||
}
|
Reference in New Issue
Block a user