106 lines
2.4 KiB
C++
106 lines
2.4 KiB
C++
|
#pragma once
|
||
|
#include <string>
|
||
|
#include <vector>
|
||
|
#include <iostream>
|
||
|
#include <memory>
|
||
|
#include <iterator>
|
||
|
#include "card.hpp"
|
||
|
#include "score.hpp"
|
||
|
#ifdef GAME_HPP
|
||
|
#include "game.hpp"
|
||
|
#endif
|
||
|
|
||
|
class Player
|
||
|
{
|
||
|
|
||
|
public:
|
||
|
int wins = 0;
|
||
|
int losses = 0;
|
||
|
int ties = 0;
|
||
|
int chips = 1000;
|
||
|
double winRate;
|
||
|
double lossRate;
|
||
|
double tieRate;
|
||
|
std::string name;
|
||
|
std::vector<Card> cards = {};
|
||
|
std::vector<Card> communityCards;
|
||
|
Score score;
|
||
|
/*
|
||
|
Player(const Player & player){
|
||
|
this->name = player.name;
|
||
|
//this->cards.assign(player.cards.begin(), player.cards.end());
|
||
|
//this->cards.push_back(Card("SA"));
|
||
|
//std::copy(player.cards.begin(), player.cards.end(), back_inserter(cards)); //std::vector(player.cards.begin(),player.cards.end());
|
||
|
|
||
|
//std::cout << "COPYP" << std::endl;
|
||
|
// this->cardz = player.cardz;
|
||
|
}*/
|
||
|
|
||
|
Player(std::string name = "John Doe")
|
||
|
{
|
||
|
this->name = name;
|
||
|
}
|
||
|
|
||
|
int askUser() {
|
||
|
std::cout << "Choose your option:" << std::endl;
|
||
|
std::cout << "\t\t1) Check" << std::endl;
|
||
|
std::cout << "\t\t2) Call" << std::endl;
|
||
|
std::cout << "\t\t3) Raise" << std::endl;
|
||
|
std::cout << "\t\t4) Fold" << std::endl;
|
||
|
std::cout << "\t\t5) All-in" << std::endl;
|
||
|
int answer = 0;
|
||
|
std::cin >> answer;
|
||
|
return answer;
|
||
|
}
|
||
|
|
||
|
void reset()
|
||
|
{
|
||
|
this->cards.clear();
|
||
|
this->communityCards.clear();
|
||
|
this->cards.erase(this->cards.begin(), this->cards.end());
|
||
|
this->communityCards.erase(this->communityCards.begin(), this->communityCards.end());
|
||
|
this->score = Score();
|
||
|
}
|
||
|
void update()
|
||
|
{
|
||
|
double total = this->wins + this->losses + this->ties;
|
||
|
this->winRate = this->wins / total * 100;
|
||
|
this->lossRate = this->losses / total * 100;
|
||
|
this->tieRate = this->ties / total * 100;
|
||
|
|
||
|
}
|
||
|
void setCards(const Card card1, const Card card2)
|
||
|
{
|
||
|
this->cards.push_back(card1);
|
||
|
this->cards.push_back(card2);
|
||
|
this->score.setPlayerCards(this->cards);
|
||
|
}
|
||
|
void setCommunityCards(std::vector<Card> cards)
|
||
|
{
|
||
|
this->communityCards = cards;
|
||
|
this->score.setCommunityCards(this->communityCards);
|
||
|
}
|
||
|
|
||
|
void thePreFlop()
|
||
|
|
||
|
{
|
||
|
}
|
||
|
void theFlop()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
void theTurn()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
void theRiver()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
void showDown()
|
||
|
{
|
||
|
this->update();
|
||
|
}
|
||
|
|
||
|
};
|