Parse kanji records such as "7六歩", the style of which is generally used to write Shogi records in Japanese. More...
#include <kanjiMove.h>
Public Member Functions | |
KanjiMove () | |
~KanjiMove () | |
const Move | strToMove (const std::string &, const NumEffectState &state, const Move &last_move) const |
Convert a Japanese string (one token) to a move object. | |
void | setVerbose (bool verbose) |
Square | toSquare (const std::string &) const |
Ptype | toPtype (const std::string &) const |
Private Types | |
typedef std::list< Move > | found_moves_t |
typedef hash_map< std::string, Square, boost::hash < std::string > > | str2position_t |
typedef hash_map< std::string, Ptype, boost::hash < std::string > > | str2piece_t |
Private Member Functions | |
void | selectCandidates (found_moves_t &found, std::string &str, const Square &to_pos, const Player &player) const |
Private Attributes | |
str2position_t | str2position |
str2piece_t | str2piece |
bool | verbose |
Parse kanji records such as "7六歩", the style of which is generally used to write Shogi records in Japanese.
Definition at line 27 of file kanjiMove.h.
typedef std::list<Move> osl::record::KanjiMove::found_moves_t [private] |
Definition at line 44 of file kanjiMove.h.
typedef hash_map<std::string, Ptype, boost::hash<std::string> > osl::record::KanjiMove::str2piece_t [private] |
Definition at line 52 of file kanjiMove.h.
typedef hash_map<std::string, Square, boost::hash<std::string> > osl::record::KanjiMove::str2position_t [private] |
Definition at line 50 of file kanjiMove.h.
osl::record::KanjiMove::KanjiMove | ( | ) |
Definition at line 223 of file kanjiMove.cc.
References osl::BISHOP, osl::record::StandardCharacters::dan, osl::GOLD, osl::record::K_BISHOP, osl::record::K_GOLD, osl::record::K_KING, osl::record::K_KNIGHT, osl::record::K_LANCE, osl::record::K_PAWN, osl::record::K_PBISHOP, osl::record::K_PKNIGHT_D, osl::record::K_PLANCE_D, osl::record::K_PPAWN, osl::record::K_PROOK, osl::record::K_PROOK2, osl::record::K_PSILVER_D, osl::record::K_ROOK, osl::record::K_SILVER, osl::KING, osl::KNIGHT, osl::LANCE, osl::PAWN, osl::PBISHOP, osl::PKNIGHT, osl::PLANCE, osl::PPAWN, osl::PROOK, osl::PSILVER, osl::ROOK, osl::SILVER, str2piece, str2position, and osl::record::StandardCharacters::suji.
osl::record::KanjiMove::~KanjiMove | ( | ) |
Definition at line 253 of file kanjiMove.cc.
void osl::record::KanjiMove::selectCandidates | ( | found_moves_t & | found, |
std::string & | str, | ||
const Square & | to_pos, | ||
const Player & | player | ||
) | const [private] |
Definition at line 276 of file kanjiMove.cc.
References osl::BLACK, osl::Move::from(), osl::record::K_HIDARI, osl::record::K_HIKU, osl::record::K_MIGI, osl::record::K_SHITA, osl::record::K_SUGU, osl::record::K_UE, osl::record::K_YORU, osl::record::K_YUKU, osl::eval::max(), osl::eval::min(), moveFromX(), moveFromY(), osl::WHITE, osl::Square::x(), and osl::Square::y().
void osl::record::KanjiMove::setVerbose | ( | bool | verbose | ) | [inline] |
Definition at line 39 of file kanjiMove.h.
References verbose.
Referenced by osl::record::ki2::InputStream::InputStream().
const osl::Move osl::record::KanjiMove::strToMove | ( | const std::string & | orig, |
const NumEffectState & | state, | ||
const Move & | last_move | ||
) | const |
Convert a Japanese string (one token) to a move object.
eliminate duplicate moves
Definition at line 359 of file kanjiMove.cc.
References osl::BLACK, osl::find(), osl::Move::INVALID(), osl::Move::isDrop(), osl::Move::isPromotion(), osl::record::K_BLACK_SIGN, osl::record::K_FUNARI, osl::record::K_NARU, osl::record::K_ONAZI, osl::record::K_SPACE, osl::record::K_UTSU, moves, osl::Move::oldPtype(), osl::Move::to(), verbose, and osl::WHITE.
osl::Ptype osl::record::KanjiMove::toPtype | ( | const std::string & | s | ) | const |
Definition at line 267 of file kanjiMove.cc.
Referenced by osl::record::kakinoki::strToMove().
osl::Square osl::record::KanjiMove::toSquare | ( | const std::string & | s | ) | const |
Definition at line 258 of file kanjiMove.cc.
Referenced by osl::record::kakinoki::strToMove().
str2piece_t osl::record::KanjiMove::str2piece [private] |
Definition at line 53 of file kanjiMove.h.
Referenced by KanjiMove().
Definition at line 51 of file kanjiMove.h.
Referenced by KanjiMove().
bool osl::record::KanjiMove::verbose [private] |
Definition at line 54 of file kanjiMove.h.
Referenced by setVerbose().