Skip to content
Permalink
Browse files

Minor style clean-up

  • Loading branch information...
andrewprock committed Jul 7, 2019
1 parent 484ad65 commit 5de0ca1021026c11a5395db25bf8aec4db899a31
Showing with 28,601 additions and 28,539 deletions.
  1. +3 −3 src/lib/pokerstove/penum/CardDistribution.cpp
  2. +10 −11 src/lib/pokerstove/penum/CardDistribution.h
  3. +3 −4 src/lib/pokerstove/penum/PartitionEnumerator.h
  4. +12 −14 src/lib/pokerstove/penum/ShowdownEnumerator.cpp
  5. +11 −9 src/lib/pokerstove/penum/SimpleDeck.hpp
  6. +5 −10 src/lib/pokerstove/peval/BadugiHandEvaluator.h
  7. +211 −204 src/lib/pokerstove/peval/CardSet.cpp
  8. +55 −79 src/lib/pokerstove/peval/CardSet.h
  9. +1 −1 src/lib/pokerstove/peval/CardSetGenerators.cpp
  10. +1 −0 src/lib/pokerstove/peval/CardSetGenerators.h
  11. +8 −11 src/lib/pokerstove/peval/DeuceToSevenHandEvaluator.h
  12. +7 −11 src/lib/pokerstove/peval/DrawHighHandEvaluator.h
  13. +3 −6 src/lib/pokerstove/peval/HoldemHandEvaluator.h
  14. +26 −33 src/lib/pokerstove/peval/OmahaEightHandEvaluator.h
  15. +6 −13 src/lib/pokerstove/peval/OmahaHighHandEvaluator.h
  16. +23 −40 src/lib/pokerstove/peval/PokerEvaluation.cpp
  17. +87 −117 src/lib/pokerstove/peval/PokerEvaluation.h
  18. +27,728 −27,500 src/lib/pokerstove/peval/PokerEvaluationTables.h
  19. +1 −2 src/lib/pokerstove/peval/PokerHand.cpp
  20. +55 −58 src/lib/pokerstove/peval/PokerHand.h
  21. +78 −67 src/lib/pokerstove/peval/PokerHandEvaluation.h
  22. +4 −4 src/lib/pokerstove/peval/PokerHandEvaluator.cpp
  23. +13 −19 src/lib/pokerstove/peval/PokerHandEvaluator.h
  24. +1 −2 src/lib/pokerstove/peval/PokerHandEvaluator.test.cpp
  25. +95 −109 src/lib/pokerstove/peval/PokerHandEvaluator_Alloc.cpp
  26. +31 −54 src/lib/pokerstove/peval/Rank.cpp
  27. +44 −46 src/lib/pokerstove/peval/Rank.h
  28. +2 −4 src/lib/pokerstove/peval/RazzHandEvaluator.h
  29. +1 −2 src/lib/pokerstove/peval/StudEightHandEvaluator.h
  30. +3 −6 src/lib/pokerstove/peval/StudHandEvaluator.h
  31. +6 −12 src/lib/pokerstove/peval/Suit.cpp
  32. +16 −18 src/lib/pokerstove/peval/Suit.h
  33. +40 −44 src/lib/pokerstove/peval/UniversalHandEvaluator.h
  34. +3 −6 src/programs/ps-colex/main.cpp
  35. +4 −7 src/programs/ps-eval/main.cpp
  36. +4 −13 src/programs/ps-lut/main.cpp
@@ -8,9 +8,9 @@
#include <boost/lexical_cast.hpp>
#include <boost/math/special_functions/binomial.hpp>
#include <iostream>
#include <vector>
#include <pokerstove/peval/Card.h>
#include <pokerstove/util/combinations.h>
#include <vector>

using namespace std;
using namespace pokerstove;
@@ -51,8 +51,8 @@ string CardDistribution::str() const
string ret;
for (size_t i = 0; i < _handList.size(); i++) {
const CardSet& hand = _handList[i];
ret += (i > 0 ? "," : "") +
(boost::format("%s=%.3f") % hand.str() % weight(hand)).str();
ret += (i > 0 ? "," : "")
+ (boost::format("%s=%.3f") % hand.str() % weight(hand)).str();
}
return ret;
}
@@ -6,9 +6,9 @@
#define PENUM_CARDDISTRIBUTION_H_

#include <map>
#include <pokerstove/peval/CardSet.h>
#include <string>
#include <vector>
#include <pokerstove/peval/CardSet.h>

namespace pokerstove
{
@@ -23,13 +23,13 @@ class CardDistribution
* Initialize it to a "random" distribution, which is defined as the empty
* set
*/
CardDistribution(); //!< use 0 cards for all elements
explicit CardDistribution(size_t n); //!< use N cards for all elements
CardDistribution(); //!< use 0 cards for all elements
explicit CardDistribution(size_t n); //!< use N cards for all elements
explicit CardDistribution(const CardSet& cs);
CardDistribution(const CardDistribution& cd);
CardDistribution& operator=(const CardDistribution& other);

virtual ~CardDistribution() {} //!< for the virtual methods
virtual ~CardDistribution() {} //!< for the virtual methods

void clear();

@@ -49,20 +49,18 @@ class CardDistribution
* Printing and parseing.
* default implementations of these are trivial and support only raw cards
*/
virtual bool
parse(const std::string& input); //!< parses according to distribution type
virtual bool parse(const std::string& input); //!< parses according to distribution type

virtual std::string display() const; //!< prints ...
virtual std::string display() const; //!< prints ...

/**
* string of the raw hand=weight values in the distribution. comma
* separated
*/
std::string str() const;

void fill(int n); //!< fill with all n card permutations of deck
void fill(const CardSet& cs,
int n); //!< fill with all n card permutations of CardSet
void fill(int n); //!< fill with all n card permutations of deck
void fill(const CardSet& cs, int n); //!< fill with all n card permutations of CardSet

/**
* return the total number of hands in the distribution
@@ -88,9 +86,10 @@ class CardDistribution
private:
const double& weight(const CardSet& cards) const; // operator[]

std::vector<CardSet> _handList;
std::vector<CardSet> _handList;
std::map<CardSet, double> _weights;
};

} // namespace pokerstove

#endif // PENUM_CARDDISTRIBUTION_H_
@@ -5,10 +5,10 @@
#ifndef COMMON_ENUM_PARTITIONENUMERATOR_H_
#define COMMON_ENUM_PARTITIONENUMERATOR_H_

#include <boost/lexical_cast.hpp>
#include <cstdint>
#include <pokerstove/util/combinations.h>
#include <vector>
#include <boost/lexical_cast.hpp>
#include <pokerstove/util/combinations.h>

namespace pokerstove
{
@@ -211,8 +211,7 @@ class PartitionEnumerator2
else if (n == 0)
{
size_t i = 0;
for (std::vector<size_t>::iterator it = _subsets[0].begin();
it != _subsets[0].end(); it++)
for (auto it = _subsets[0].begin(); it != _subsets[0].end(); it++)
*it = i++;
}
_pcombos[n].reset();
@@ -19,9 +19,9 @@ namespace pokerstove

ShowdownEnumerator::ShowdownEnumerator() {}

vector<EquityResult> ShowdownEnumerator::calculateEquity(
const vector<CardDistribution>& dists, const CardSet& board,
boost::shared_ptr<PokerHandEvaluator> peval) const
vector<EquityResult> ShowdownEnumerator::calculateEquity(const vector<CardDistribution>& dists,
const CardSet& board,
boost::shared_ptr<PokerHandEvaluator> peval) const
{
if (peval.get() == NULL)
throw runtime_error("ShowdownEnumerator, null evaluator");
@@ -51,10 +51,10 @@ vector<EquityResult> ShowdownEnumerator::calculateEquity(
SimpleDeck deck;
CardSet dead;
double weight;
vector<CardSet> ehands(ndists + nboards);
vector<size_t> parts(ndists + nboards);
vector<CardSet> cardPartitions(ndists + nboards);
vector<PokerHandEvaluation> evals(ndists); // NO BOARD
vector<CardSet> ehands (ndists + nboards);
vector<size_t> parts (ndists + nboards);
vector<CardSet> cardPartitions (ndists + nboards);
vector<PokerHandEvaluation> evals (ndists); // NO BOARD

// copy quickness
CardSet* copydest = &ehands[0];
@@ -73,14 +73,14 @@ vector<EquityResult> ShowdownEnumerator::calculateEquity(
if (i < ndists)
{
cardPartitions[i] = dists[i][o[i]];
parts[i] = handsize - cardPartitions[i].size();
weight *= dists[i][cardPartitions[i]];
parts[i] = handsize - cardPartitions[i].size();
weight *= dists[i][cardPartitions[i]];
}
else
{
// this allows us to have board distributions in the future
cardPartitions[i] = board;
parts[i] = boardsize - cardPartitions[i].size();
parts[i] = boardsize - cardPartitions[i].size();
}
disjoint = disjoint && dead.disjoint(cardPartitions[i]);
dead |= cardPartitions[i];
@@ -102,11 +102,9 @@ vector<EquityResult> ShowdownEnumerator::calculateEquity(
// clause? A: need to rework tracking of whether a board is
// needed
if (nboards > 0)
peval->evaluateShowdown(ehands, ehands[ndists], evals,
results, weight);
peval->evaluateShowdown(ehands, ehands[ndists], evals, results, weight);
else
peval->evaluateShowdown(ehands, board, evals, results,
weight);
peval->evaluateShowdown(ehands, board, evals, results, weight);
} while (pe.next());
}
} while (o.next());
@@ -22,7 +22,8 @@ namespace pokerstove
* used for removing cards from the deck
*/
struct isLive : public std::binary_function<pokerstove::CardSet,
pokerstove::CardSet, bool>
pokerstove::CardSet,
bool>
{
bool operator()(const CardSet& c, const CardSet& dead) const
{
@@ -123,10 +124,11 @@ class SimpleDeck
*/
CardSet peek(uint64_t mask) const
{
#ifdef WIN32
// disable the unary negation of unsigned int
#pragma warning(disable : 4146)
#endif
#ifdef WIN32
// disable the unary negation of unsigned int
#pragma warning(disable : 4146)
#endif

CardSet ret;

uint32_t lower = static_cast<uint32_t>(mask & UINT32_C(0xFFFFFFFF));
@@ -145,10 +147,10 @@ class SimpleDeck
upper ^= (upper & -upper);
}

#ifdef WIN32
// set back to default
#pragma warning(default : 4146)
#endif
#ifdef WIN32
// set back to default
#pragma warning(default : 4146)
#endif

return ret;
}
@@ -20,24 +20,19 @@ class BadugiHandEvaluator : public PokerHandEvaluator
, _numDraws(0)
{}

virtual PokerHandEvaluation evaluateHand(const CardSet& hand,
const CardSet&) const
virtual PokerHandEvaluation evaluateHand(const CardSet& hand, const CardSet&) const
{
return PokerHandEvaluation(hand.evaluateBadugi());
}

virtual PokerEvaluation
evaluateRanks(const CardSet& hand, const CardSet& board = CardSet(0)) const
virtual PokerEvaluation evaluateRanks(const CardSet& hand, const CardSet& board = CardSet(0)) const
{
throw std::runtime_error(
"BadugiHandEvaluator::evaluateRanks, not implemented");
throw std::runtime_error("BadugiHandEvaluator::evaluateRanks, not implemented");
}

virtual PokerEvaluation
evaluateSuits(const CardSet& hand, const CardSet& board = CardSet(0)) const
virtual PokerEvaluation evaluateSuits(const CardSet& hand, const CardSet& board = CardSet(0)) const
{
throw std::runtime_error(
"BadugiHandEvaluator::evaluateSuits, not implemented");
throw std::runtime_error("BadugiHandEvaluator::evaluateSuits, not implemented");
}

virtual size_t handSize() const { return 4; }

0 comments on commit 5de0ca1

Please sign in to comment.
You can’t perform that action at this time.