Adding assert tools back

This commit is contained in:
2022-11-07 06:55:15 -08:00
parent 6f4ab49caa
commit 4c2fc4cfcf
8 changed files with 276 additions and 25 deletions

View File

@ -0,0 +1,10 @@
# Copyright (c) 2022 Dominic Masters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
# Sources
target_sources(${DAWN_TARGET_NAME}
PRIVATE
PokerGame.cpp
)

59
src/dawn/poker/Card.hpp Normal file
View File

@ -0,0 +1,59 @@
// Copyright (c) 2022 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
enum CardSuit {
CLUBS = 0,
DIAMONDS = 1,
HEARTS = 2,
SPADES = 3
};
enum CardValue {
TWO = 0,
THREE = 1,
FOUR = 2,
FIVE = 3,
SIX = 4,
SEVEN = 5,
EIGHT = 6,
NINE = 7,
TEN = 8,
JACK = 9,
QUEEN = 10,
KING = 11,
ACE = 12
};
/** Count of cards in each suit */
#define CARD_COUNT_PER_SUIT 13
/** Count of suits */
#define CARD_SUIT_COUNT 4
/** Standard Card Deck Size */
#define CARD_DECK_SIZE CARD_COUNT_PER_SUIT*CARD_SUIT_COUNT
struct Card {
uint8_t cardValue;
Card(CardSuit suit, CardValue num) :
cardValue((suit * CARD_COUNT_PER_SUIT) + num)
{
}
Card(uint8_t cv) : cardValue(cv) {
}
CardValue getValue() {
return (CardValue)(cardValue % CARD_COUNT_PER_SUIT);
}
CardSuit getSuit() {
return (CardSuit)(cardValue / CARD_COUNT_PER_SUIT);
}
};

View File

@ -0,0 +1,12 @@
// Copyright (c) 2022 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "PokerGame.hpp"
using namespace Dawn;
PokerGame::PokerGame() {
}

View File

@ -0,0 +1,42 @@
// Copyright (c) 2022 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "scene/SceneItemComponent.hpp"
#include "Card.hpp"
/** The default blind cost for the big blind. */
#define POKER_BLIND_BIG_DEFAULT 600
/** The default blind cost for the small blind. (Defaults half big blind) */
#define POKER_BLIND_SMALL_DEFAULT (POKER_BLIND_BIG_DEFAULT/2)
namespace Dawn {
class PokerPlayer {
public:
int32_t i;
};
class PokerPot {
public:
int32_t i;
};
class PokerGame {
protected:
std::vector<PokerPlayer> players;
std::vector<struct Card> cards;
std::vector<struct Card> grave;
std::vector<struct Card> community;
uint8_t dealerIndex;
uint8_t smallBlindIndex;
uint8_t bigBlindIndex;
uint8_t betterIndex;
int32_t smallBlind = POKER_BLIND_SMALL_DEFAULT;
int32_t bigBlind = POKER_BLIND_BIG_DEFAULT;
public:
PokerGame();
};
}