/**
 * Copyright (c) 2021 Dominic Masters
 * 
 * This software is released under the MIT License.
 * https://opensource.org/licenses/MIT
 */

#include "player.h"

bool pokerPlayerIsAlive(pokerplayer_t *player) {
  return !(player->state & (POKER_PLAYER_STATE_FOLDED|POKER_PLAYER_STATE_OUT));
}

void pokerPlayerReset(pokerplayer_t *player) {
  player->cardCount = 0;
  player->currentBet = 0;

  // Invert then bitwise AND to turn off.
  player->state &= ~(
    POKER_PLAYER_STATE_FOLDED | 
    POKER_PLAYER_STATE_SHOWING
  );
}