Skip to content

Commit 5de0ca1

Browse files
committed
Minor style clean-up
1 parent 484ad65 commit 5de0ca1

36 files changed

+28601
-28539
lines changed

src/lib/pokerstove/penum/CardDistribution.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
#include <boost/lexical_cast.hpp>
99
#include <boost/math/special_functions/binomial.hpp>
1010
#include <iostream>
11+
#include <vector>
1112
#include <pokerstove/peval/Card.h>
1213
#include <pokerstove/util/combinations.h>
13-
#include <vector>
1414

1515
using namespace std;
1616
using namespace pokerstove;
@@ -51,8 +51,8 @@ string CardDistribution::str() const
5151
string ret;
5252
for (size_t i = 0; i < _handList.size(); i++) {
5353
const CardSet& hand = _handList[i];
54-
ret += (i > 0 ? "," : "") +
55-
(boost::format("%s=%.3f") % hand.str() % weight(hand)).str();
54+
ret += (i > 0 ? "," : "")
55+
+ (boost::format("%s=%.3f") % hand.str() % weight(hand)).str();
5656
}
5757
return ret;
5858
}

src/lib/pokerstove/penum/CardDistribution.h

+10-11
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
#define PENUM_CARDDISTRIBUTION_H_
77

88
#include <map>
9-
#include <pokerstove/peval/CardSet.h>
109
#include <string>
1110
#include <vector>
11+
#include <pokerstove/peval/CardSet.h>
1212

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

32-
virtual ~CardDistribution() {} //!< for the virtual methods
32+
virtual ~CardDistribution() {} //!< for the virtual methods
3333

3434
void clear();
3535

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

55-
virtual std::string display() const; //!< prints ...
54+
virtual std::string display() const; //!< prints ...
5655

5756
/**
5857
* string of the raw hand=weight values in the distribution. comma
5958
* separated
6059
*/
6160
std::string str() const;
6261

63-
void fill(int n); //!< fill with all n card permutations of deck
64-
void fill(const CardSet& cs,
65-
int n); //!< fill with all n card permutations of CardSet
62+
void fill(int n); //!< fill with all n card permutations of deck
63+
void fill(const CardSet& cs, int n); //!< fill with all n card permutations of CardSet
6664

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

91-
std::vector<CardSet> _handList;
89+
std::vector<CardSet> _handList;
9290
std::map<CardSet, double> _weights;
9391
};
92+
9493
} // namespace pokerstove
9594

9695
#endif // PENUM_CARDDISTRIBUTION_H_

src/lib/pokerstove/penum/PartitionEnumerator.h

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
#ifndef COMMON_ENUM_PARTITIONENUMERATOR_H_
66
#define COMMON_ENUM_PARTITIONENUMERATOR_H_
77

8-
#include <boost/lexical_cast.hpp>
98
#include <cstdint>
10-
#include <pokerstove/util/combinations.h>
119
#include <vector>
10+
#include <boost/lexical_cast.hpp>
11+
#include <pokerstove/util/combinations.h>
1212

1313
namespace pokerstove
1414
{
@@ -211,8 +211,7 @@ class PartitionEnumerator2
211211
else if (n == 0)
212212
{
213213
size_t i = 0;
214-
for (std::vector<size_t>::iterator it = _subsets[0].begin();
215-
it != _subsets[0].end(); it++)
214+
for (auto it = _subsets[0].begin(); it != _subsets[0].end(); it++)
216215
*it = i++;
217216
}
218217
_pcombos[n].reset();

src/lib/pokerstove/penum/ShowdownEnumerator.cpp

+12-14
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ namespace pokerstove
1919

2020
ShowdownEnumerator::ShowdownEnumerator() {}
2121

22-
vector<EquityResult> ShowdownEnumerator::calculateEquity(
23-
const vector<CardDistribution>& dists, const CardSet& board,
24-
boost::shared_ptr<PokerHandEvaluator> peval) const
22+
vector<EquityResult> ShowdownEnumerator::calculateEquity(const vector<CardDistribution>& dists,
23+
const CardSet& board,
24+
boost::shared_ptr<PokerHandEvaluator> peval) const
2525
{
2626
if (peval.get() == NULL)
2727
throw runtime_error("ShowdownEnumerator, null evaluator");
@@ -51,10 +51,10 @@ vector<EquityResult> ShowdownEnumerator::calculateEquity(
5151
SimpleDeck deck;
5252
CardSet dead;
5353
double weight;
54-
vector<CardSet> ehands(ndists + nboards);
55-
vector<size_t> parts(ndists + nboards);
56-
vector<CardSet> cardPartitions(ndists + nboards);
57-
vector<PokerHandEvaluation> evals(ndists); // NO BOARD
54+
vector<CardSet> ehands (ndists + nboards);
55+
vector<size_t> parts (ndists + nboards);
56+
vector<CardSet> cardPartitions (ndists + nboards);
57+
vector<PokerHandEvaluation> evals (ndists); // NO BOARD
5858

5959
// copy quickness
6060
CardSet* copydest = &ehands[0];
@@ -73,14 +73,14 @@ vector<EquityResult> ShowdownEnumerator::calculateEquity(
7373
if (i < ndists)
7474
{
7575
cardPartitions[i] = dists[i][o[i]];
76-
parts[i] = handsize - cardPartitions[i].size();
77-
weight *= dists[i][cardPartitions[i]];
76+
parts[i] = handsize - cardPartitions[i].size();
77+
weight *= dists[i][cardPartitions[i]];
7878
}
7979
else
8080
{
8181
// this allows us to have board distributions in the future
8282
cardPartitions[i] = board;
83-
parts[i] = boardsize - cardPartitions[i].size();
83+
parts[i] = boardsize - cardPartitions[i].size();
8484
}
8585
disjoint = disjoint && dead.disjoint(cardPartitions[i]);
8686
dead |= cardPartitions[i];
@@ -102,11 +102,9 @@ vector<EquityResult> ShowdownEnumerator::calculateEquity(
102102
// clause? A: need to rework tracking of whether a board is
103103
// needed
104104
if (nboards > 0)
105-
peval->evaluateShowdown(ehands, ehands[ndists], evals,
106-
results, weight);
105+
peval->evaluateShowdown(ehands, ehands[ndists], evals, results, weight);
107106
else
108-
peval->evaluateShowdown(ehands, board, evals, results,
109-
weight);
107+
peval->evaluateShowdown(ehands, board, evals, results, weight);
110108
} while (pe.next());
111109
}
112110
} while (o.next());

src/lib/pokerstove/penum/SimpleDeck.hpp

+11-9
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ namespace pokerstove
2222
* used for removing cards from the deck
2323
*/
2424
struct isLive : public std::binary_function<pokerstove::CardSet,
25-
pokerstove::CardSet, bool>
25+
pokerstove::CardSet,
26+
bool>
2627
{
2728
bool operator()(const CardSet& c, const CardSet& dead) const
2829
{
@@ -123,10 +124,11 @@ class SimpleDeck
123124
*/
124125
CardSet peek(uint64_t mask) const
125126
{
126-
#ifdef WIN32
127-
// disable the unary negation of unsigned int
128-
#pragma warning(disable : 4146)
129-
#endif
127+
#ifdef WIN32
128+
// disable the unary negation of unsigned int
129+
#pragma warning(disable : 4146)
130+
#endif
131+
130132
CardSet ret;
131133

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

148-
#ifdef WIN32
149-
// set back to default
150-
#pragma warning(default : 4146)
151-
#endif
150+
#ifdef WIN32
151+
// set back to default
152+
#pragma warning(default : 4146)
153+
#endif
152154

153155
return ret;
154156
}

src/lib/pokerstove/peval/BadugiHandEvaluator.h

+5-10
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,19 @@ class BadugiHandEvaluator : public PokerHandEvaluator
2020
, _numDraws(0)
2121
{}
2222

23-
virtual PokerHandEvaluation evaluateHand(const CardSet& hand,
24-
const CardSet&) const
23+
virtual PokerHandEvaluation evaluateHand(const CardSet& hand, const CardSet&) const
2524
{
2625
return PokerHandEvaluation(hand.evaluateBadugi());
2726
}
2827

29-
virtual PokerEvaluation
30-
evaluateRanks(const CardSet& hand, const CardSet& board = CardSet(0)) const
28+
virtual PokerEvaluation evaluateRanks(const CardSet& hand, const CardSet& board = CardSet(0)) const
3129
{
32-
throw std::runtime_error(
33-
"BadugiHandEvaluator::evaluateRanks, not implemented");
30+
throw std::runtime_error("BadugiHandEvaluator::evaluateRanks, not implemented");
3431
}
3532

36-
virtual PokerEvaluation
37-
evaluateSuits(const CardSet& hand, const CardSet& board = CardSet(0)) const
33+
virtual PokerEvaluation evaluateSuits(const CardSet& hand, const CardSet& board = CardSet(0)) const
3834
{
39-
throw std::runtime_error(
40-
"BadugiHandEvaluator::evaluateSuits, not implemented");
35+
throw std::runtime_error("BadugiHandEvaluator::evaluateSuits, not implemented");
4136
}
4237

4338
virtual size_t handSize() const { return 4; }

0 commit comments

Comments
 (0)