summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Fultz <jfultz@wolfram.com>2019-03-11 11:03:15 -0500
committerJohn Fultz <jfultz@wolfram.com>2019-07-21 02:02:55 -0700
commit4cd51c4a7233dd4334832cc05bfaa91221d98916 (patch)
tree299837fd06d78f36871d3746559394e307ad5433
parentd30b4adb9646da26bace320a0abfaace6c05368e (diff)
Code cleanup.
Remove unneeded constructors and use member initializers for Move, MoveList.
-rw-r--r--move.cpp9
-rw-r--r--move.h28
2 files changed, 11 insertions, 26 deletions
diff --git a/move.cpp b/move.cpp
index bcec15a..349f7d0 100644
--- a/move.cpp
+++ b/move.cpp
@@ -24,11 +24,6 @@
using namespace Quackle;
-Move::Move()
- : score(0), isBingo(false), equity(0), win(0), possibleWin(0), action(Move::Pass), horizontal(false), startrow(0), startcol(0), m_isChallengedPhoney(false), m_scoreAddition(0)
-{
-}
-
bool operator==(const Move &move1, const Move &move2)
{
bool ret = false;
@@ -360,10 +355,6 @@ UVOStream& operator<<(UVOStream& o, const Quackle::Move& m)
//////////
-MoveList::MoveList()
-{
-}
-
bool MoveList::contains(const Move &move) const
{
const MoveList::const_iterator ourEnd(end());
diff --git a/move.h b/move.h
index 18a96bf..7a66945 100644
--- a/move.h
+++ b/move.h
@@ -45,25 +45,21 @@ class Move
public:
enum Action { Place = 0, PlaceError, Exchange, BlindExchange, Pass, UnusedTilesBonus, UnusedTilesBonusError, TimePenalty, Nonmove };
- // creates a pass move with 0 equity;
- // tiles is "", score and equity are zero
- Move();
-
- int score;
- bool isBingo;
+ int score = 0;
+ bool isBingo = false;
// 0 if this is a challenged phoney; score field otherwise
int effectiveScore() const;
- double equity;
- double win; // between 0 and 1 inclusive
- double possibleWin;
+ double equity = 0.;
+ double win = 0.; // between 0 and 1 inclusive
+ double possibleWin = 0.;
- Action action;
+ Action action = Move::Pass;
- bool horizontal;
- int startrow;
- int startcol;
+ bool horizontal = false;
+ int startrow = 0;
+ int startcol = 0;
// returns whether this is not a Nonmove
bool isAMove() const;
@@ -133,8 +129,8 @@ public:
private:
LetterString m_tiles;
LetterString m_prettyTiles;
- bool m_isChallengedPhoney;
- int m_scoreAddition;
+ bool m_isChallengedPhoney = false;
+ int m_scoreAddition = 0;
};
// comparison based on action, then tiles, then horizontalness, then startrow, then endcol
@@ -143,8 +139,6 @@ bool operator<(const Quackle::Move &move1, const Quackle::Move &move2);
class MoveList : public vector<Move>
{
public:
- MoveList();
-
enum SortType { Equity, Score, Alphabetical, Win};
// perform stable sort