Dawn/src/poker/turn.c

28 lines
611 B
C

/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "turn.h"
pokerturn_t pokerTurnGet(poker_t *poker, uint8_t playerIndex) {
pokerturn_t turn;
pokerplayer_t *player;
player = poker->players + playerIndex;
// Can the player do anything?
turn.type = POKER_TURN_TYPE_OUT;
if(player->state & POKER_PLAYER_STATE_FOLDED) return turn;
if(player->state & POKER_PLAYER_STATE_OUT) return turn;
// I have nfi
turn.type = POKER_TURN_TYPE_BET;
turn.chips = 1;
turn.confidence = 1;
return turn;
}