moveLogProb.h
Go to the documentation of this file.
#ifndef OSL_MOVELOGPROB_H
#define OSL_MOVELOGPROB_H
#include "osl/basic_type.h"
#include <iosfwd>
namespace osl
{
class MoveLogProb : private Move
{
int log_prob;
public:
MoveLogProb(Move m,int l) : Move(m),log_prob(l)
{
assert(m.isInvalid() || m.isValidOrPass());
}
MoveLogProb() : log_prob(0) {}
void setLogProb(int l) { log_prob=l; }
void setLogProbAtLeast(int l)
{
if (logProb() < l)
setLogProb(l);
}
void setLogProbAtMost(int l)
{
if (logProb() > l)
setLogProb(l);
}
const Move move()const{ return *this; }
int logProb()const{ return log_prob; }
bool validMove() const { return log_prob > 0; }
using Move::player;
using Move::isNormal;
using Move::isPass;
};
std::ostream& operator<<(std::ostream& os,MoveLogProb const& move);
inline bool operator==(MoveLogProb const& lhs,MoveLogProb const& rhs)
{
return lhs.move()==rhs.move() && lhs.logProb()==rhs.logProb();
}
inline bool operator<(MoveLogProb const& lhs,MoveLogProb const& rhs)
{
if (lhs.move() != rhs.move())
return lhs.move() < rhs.move();
return lhs.logProb() < rhs.logProb();
}
} // namespace ostream
#endif /* OSL_MOVELOGPROB_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
basic_type.h
osl::MoveLogProb
Definition moveLogProb.h:10
osl::MoveLogProb::logProb
int logProb() const
Definition moveLogProb.h:40
osl::MoveLogProb::setLogProbAtLeast
void setLogProbAtLeast(int l)
logProb を数字上最低 l にする.
Definition moveLogProb.h:24
osl::MoveLogProb::setLogProb
void setLogProb(int l)
Definition moveLogProb.h:19
osl::MoveLogProb::validMove
bool validMove() const
Definition moveLogProb.h:41
osl::MoveLogProb::move
const Move move() const
Definition moveLogProb.h:39
osl::MoveLogProb::setLogProbAtMost
void setLogProbAtMost(int l)
logProb を数字上最高 l にする.
Definition moveLogProb.h:33
osl::MoveLogProb::MoveLogProb
MoveLogProb()
Definition moveLogProb.h:17
osl::MoveLogProb::MoveLogProb
MoveLogProb(Move m, int l)
Definition moveLogProb.h:13
osl::MoveLogProb::log_prob
int log_prob
Definition moveLogProb.h:11
osl::Move::isInvalid
bool isInvalid() const
state に apply 可能でない場合にtrue
Definition basic_type.h:1202
osl::Move::player
Player player() const
Definition basic_type.h:1195
osl::Move::isPass
bool isPass() const
Definition basic_type.h:1092
osl::Move::isValidOrPass
bool isValidOrPass() const
Definition basic_type.h:1205
osl::Move::Move
Move(int value)
Definition basic_type.h:1057
osl::Move::isNormal
bool isNormal() const
INVALID でも PASS でもない.
Definition basic_type.h:1088
osl
Definition additionalEffect.h:6
osl::operator<
bool operator<(Offset l, Offset r)
Definition basic_type.h:520
osl::operator<<
std::ostream & operator<<(std::ostream &os, Player player)
Definition basic_type.cc:14
osl::operator==
bool operator==(Square l, Square r)
Definition basic_type.h:758