From 5a585a771440e14eb2ceac3850b421c99cf5c023 Mon Sep 17 00:00:00 2001 From: Dominic Masters Date: Fri, 15 Oct 2021 10:20:31 -0700 Subject: [PATCH] Fixing more includes --- src/game/poker/actions/bet.h | 1 + src/poker/poker.c | 5 ++++ src/poker/poker.h | 10 ++------ src/poker/turn.h | 1 - test/poker/bet.h | 2 ++ test/poker/player.h | 1 + test/poker/poker.c | 49 ++++++++++++++++++++++++++++++++++++ test/poker/poker.h | 1 + 8 files changed, 61 insertions(+), 9 deletions(-) diff --git a/src/game/poker/actions/bet.h b/src/game/poker/actions/bet.h index 945cf662..c862236a 100644 --- a/src/game/poker/actions/bet.h +++ b/src/game/poker/actions/bet.h @@ -8,6 +8,7 @@ #pragma once #include "../../../libs.h" #include "../../../poker/bet.h" +#include "../../../poker/turn.h" #include "../pokerdiscussion.h" #include "action.h" #include "restack.h" diff --git a/src/poker/poker.c b/src/poker/poker.c index 9d210996..1cee45c0 100644 --- a/src/poker/poker.c +++ b/src/poker/poker.c @@ -70,8 +70,13 @@ void pokerResetBettingRound(poker_t *poker) { } void pokerTakeBlinds(poker_t *poker) { + pokerplayer_t *player; pokerBetForPlayer(poker, poker->playerSmallBlind, poker->blindSmall); + player = poker->players + poker->playerSmallBlind; + player->state = flagOff(player->state, POKER_PLAYER_STATE_HAS_BET_THIS_ROUND); pokerBetForPlayer(poker, poker->playerBigBlind, poker->blindBig); + player = poker->players + poker->playerBigBlind; + player->state = flagOff(player->state, POKER_PLAYER_STATE_HAS_BET_THIS_ROUND); } uint8_t pokerInRoundGetCount(poker_t *poker) { diff --git a/src/poker/poker.h b/src/poker/poker.h index 3e3f06b6..dfb90926 100644 --- a/src/poker/poker.h +++ b/src/poker/poker.h @@ -8,16 +8,10 @@ #pragma once #include "../libs.h" #include "../util/flags.h" -#include "../util/array.h" -#include "../util/math.h" -#include "bet.h" -#include "card.h" -#include "dealer.h" #include "fuck.h" -#include "player.h" +#include "card.h" #include "pot.h" -#include "turn.h" -#include "winner.h" +#include "bet.h" // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Fucked if I know diff --git a/src/poker/turn.h b/src/poker/turn.h index ce82d792..2c134227 100644 --- a/src/poker/turn.h +++ b/src/poker/turn.h @@ -13,7 +13,6 @@ #include "card.h" #include "winner.h" #include "pot.h" -#include "poker.h"//get callbet /** * Return a turn action for the given player to fold. diff --git a/test/poker/bet.h b/test/poker/bet.h index 043e49c0..2555d69f 100644 --- a/test/poker/bet.h +++ b/test/poker/bet.h @@ -6,5 +6,7 @@ #pragma once #include #include +#include +#include int test_bet_h(); \ No newline at end of file diff --git a/test/poker/player.h b/test/poker/player.h index bc76ec43..5501e216 100644 --- a/test/poker/player.h +++ b/test/poker/player.h @@ -9,5 +9,6 @@ #include #include #include +#include int test_player_h(); \ No newline at end of file diff --git a/test/poker/poker.c b/test/poker/poker.c index 8ec8e0d5..dc6f1576 100644 --- a/test/poker/poker.c +++ b/test/poker/poker.c @@ -126,6 +126,54 @@ void test_pokerTakeBlinds_should_TakeTheBlinds(void) { TEST_ASSERT_EQUAL_INT32(800, (poker.players + 4)->chips); } +void test_pokerTakeBlinds_should_NotCountAsBetting(void) { + poker_t poker; + pokerInit(&poker); + pokerSetBlinds(&poker, 100, 200); + + pokerPlayerChipsAdd(poker.players + pokerPlayerAdd(&poker), 1000); + pokerPlayerChipsAdd(poker.players + pokerPlayerAdd(&poker), 1000); + pokerPlayerChipsAdd(poker.players + pokerPlayerAdd(&poker), 1000); + pokerPlayerChipsAdd(poker.players + pokerPlayerAdd(&poker), 1000); + pokerPlayerChipsAdd(poker.players + pokerPlayerAdd(&poker), 1000); + + pokerDealerNew(&poker); + + TEST_ASSERT_BIT_LOW( + POKER_PLAYER_STATE_HAS_BET_THIS_ROUND, poker.players[0].state + ); + TEST_ASSERT_BIT_LOW( + POKER_PLAYER_STATE_HAS_BET_THIS_ROUND, poker.players[1].state + ); + TEST_ASSERT_BIT_LOW( + POKER_PLAYER_STATE_HAS_BET_THIS_ROUND, poker.players[2].state + ); + TEST_ASSERT_BIT_LOW( + POKER_PLAYER_STATE_HAS_BET_THIS_ROUND, poker.players[3].state + ); + TEST_ASSERT_BIT_LOW( + POKER_PLAYER_STATE_HAS_BET_THIS_ROUND, poker.players[4].state + ); + + pokerTakeBlinds(&poker); + + TEST_ASSERT_BIT_LOW( + POKER_PLAYER_STATE_HAS_BET_THIS_ROUND, poker.players[0].state + ); + TEST_ASSERT_BIT_LOW( + POKER_PLAYER_STATE_HAS_BET_THIS_ROUND, poker.players[1].state + ); + TEST_ASSERT_BIT_LOW( + POKER_PLAYER_STATE_HAS_BET_THIS_ROUND, poker.players[2].state + ); + TEST_ASSERT_BIT_LOW( + POKER_PLAYER_STATE_HAS_BET_THIS_ROUND, poker.players[3].state + ); + TEST_ASSERT_BIT_LOW( + POKER_PLAYER_STATE_HAS_BET_THIS_ROUND, poker.players[4].state + ); +} + void test_pokerPlayerGetCallBet_should_GetCallBet(void) { poker_t poker; uint8_t p0, p1, p2; @@ -186,6 +234,7 @@ int test_poker_h() { RUN_TEST(test_pokerResetBettingRound_should_ResetTheBettingRound); RUN_TEST(test_pokerTakeBlinds_should_TakeTheBlinds); RUN_TEST(test_pokerPlayerGetCallBet_should_GetCallBet); + RUN_TEST(test_pokerTakeBlinds_should_NotCountAsBetting); RUN_TEST(test_pokerInRoundGetCount_should_ReturnCountOfPlayersInRound); return UNITY_END(); diff --git a/test/poker/poker.h b/test/poker/poker.h index c0ea50a8..95157e90 100644 --- a/test/poker/poker.h +++ b/test/poker/poker.h @@ -6,5 +6,6 @@ #pragma once #include #include +#include int test_poker_h(); \ No newline at end of file