effect5x3d.h
Go to the documentation of this file.
/* effect5x3.h
*/
#ifndef PROGRESS_EFFECT5X3D_H
#define PROGRESS_EFFECT5X3D_H
#include "osl/progress.h"
#include "osl/numEffectState.h"
#include <algorithm>
namespace osl
{
namespace progress
{
struct Effect5x3d
{
static int makeProgress(Player defense, const NumEffectState& state,
Square king);
static int makeProgress(Player defense, const NumEffectState& state){
return makeProgress(defense,state,state.kingSquare(defense));
}
static int makeProgress(const NumEffectState& state)
{
return makeProgress(BLACK, state) + makeProgress(WHITE, state);
}
static const Progress16 progress16(int progress)
{
assert(progress >= 0);
const int rank = progress / 8 - 16; // 適当
return Progress16(std::max(std::min(rank, 15), 0));
}
static const Progress16 progress16each(int progress)
{
assert(progress >= 0);
const int rank = progress / 8 - 8; // 調整中
return Progress16(std::max(std::min(rank, 15), 0));
}
private:
CArray<int,2> progresses;
public:
explicit Effect5x3d(const NumEffectState& state)
{
progresses[BLACK]=makeProgress(BLACK, state);
progresses[WHITE]=makeProgress(WHITE, state);
}
void changeTurn() {}
int progress(Player p) const { return progresses[p]; }
const Progress16 progress16() const
{
return progress16(progresses[0] + progresses[1]);
}
const Progress16 progress16(Player p) const
{
return progress16each(progress(p));
}
// 必要なもの
void update(const NumEffectState& new_state, Move last_move);
};
} // namespace progress
} // namespace osl
#endif /* PROGRESS_EFFECT5X3D_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
osl::CArray
Definition container.h:20
osl::Move
圧縮していない moveの表現 .
Definition basic_type.h:1052
osl::NumEffectState
利きを持つ局面
Definition numEffectState.h:34
osl::SimpleState::kingSquare
Square kingSquare() const
Definition simpleState.h:94
osl::Square
Definition basic_type.h:532
osl::progress
Definition progress.cc:754
osl::progress::Progress16
ProgressN< 16 > Progress16
Definition progress.h:42
osl
Definition additionalEffect.h:6
osl::Player
Player
Definition basic_type.h:8
osl::WHITE
@ WHITE
Definition basic_type.h:10
osl::BLACK
@ BLACK
Definition basic_type.h:9
numEffectState.h
progress.h
osl::progress::Effect5x3d::Effect5x3d
Effect5x3d(const NumEffectState &state)
Definition effect5x3d.h:60
osl::progress::Effect5x3d::progress16
const Progress16 progress16() const
Definition effect5x3d.h:67
osl::progress::Effect5x3d::makeProgress
static int makeProgress(Player defense, const NumEffectState &state)
Definition effect5x3d.h:31
osl::progress::Effect5x3d::makeProgress
static int makeProgress(Player defense, const NumEffectState &state, Square king)
王の位置を指定したprogressの計算.
Definition effect5x3d.cc:8
osl::progress::Effect5x3d::progress16each
static const Progress16 progress16each(int progress)
0-15 の値を返す.
Definition effect5x3d.h:51
osl::progress::Effect5x3d::changeTurn
void changeTurn()
Definition effect5x3d.h:65
osl::progress::Effect5x3d::progresses
CArray< int, 2 > progresses
Definition effect5x3d.h:58
osl::progress::Effect5x3d::progress16
static const Progress16 progress16(int progress)
0-15 の値を返す
Definition effect5x3d.h:41
osl::progress::Effect5x3d::progress
int progress(Player p) const
Definition effect5x3d.h:66
osl::progress::Effect5x3d::makeProgress
static int makeProgress(const NumEffectState &state)
Definition effect5x3d.h:34
osl::progress::Effect5x3d::progress16
const Progress16 progress16(Player p) const
Definition effect5x3d.h:71
osl::progress::Effect5x3d::update
void update(const NumEffectState &new_state, Move last_move)
Definition effect5x3d.cc:34