My Project
Classes | Namespaces | Macros | Enumerations | Functions | Variables
basic_type.h File Reference
#include "osl/config.h"
#include <type_traits>
#include <cassert>
#include <iosfwd>
#include "bits/directionTraits.h"

Go to the source code of this file.

Classes

struct  osl::misc::Int2Type< v >
 
struct  osl::misc::Type2Type< T >
 
struct  osl::misc::Player2Type< P >
 
struct  osl::misc::EmptyType
 
class  osl::Offset
 座標の差分 More...
 
class  osl::Square
 
class  osl::Piece
 駒. More...
 
class  osl::Move
 圧縮していない moveの表現 . More...
 
struct  std::hash< osl::Move >
 

Namespaces

namespace  osl
 
namespace  osl::misc
 
namespace  std
 

Macros

#define NEW_PTYPEO(player, ptype)   static_cast<PtypeO>(static_cast<int>(ptype)-(16&static_cast<int>(player)))
 
#define move_assert(x)
 move 関係でつかまえ所のないエラーがでるときに定義する
 

Enumerations

enum  osl::Player { osl::BLACK =0 , osl::WHITE = -1 }
 
enum  osl::Ptype {
  osl::PTYPE_EMPTY =0 , osl::PTYPE_EDGE =1 , osl::PPAWN =2 , osl::PLANCE =3 ,
  osl::PKNIGHT =4 , osl::PSILVER =5 , osl::PBISHOP =6 , osl::PROOK =7 ,
  osl::KING =8 , osl::GOLD =9 , osl::PAWN =10 , osl::LANCE =11 ,
  osl::KNIGHT =12 , osl::SILVER =13 , osl::BISHOP =14 , osl::ROOK =15 ,
  osl::PTYPE_MIN =0 , osl::PTYPE_BASIC_MIN =KING , osl::PTYPE_PIECE_MIN =2 , osl::PTYPE_MAX =15
}
 駒の種類を4ビットでコード化する More...
 
enum  osl::PtypeO { osl::PTYPEO_MIN = PTYPE_EMPTY-16 , osl::PTYPEO_MAX = 15 }
 Player + Ptype [-15, 15] PtypeO の O は Owner の O. More...
 
enum  osl::Direction {
  osl::SHORT_DIRECTION_MIN =0 , osl::SHORT8_DIRECTION_MIN =0 , osl::UL =0 , osl::U =1 ,
  osl::UR =2 , osl::L =3 , osl::R =4 , osl::DL =5 ,
  osl::D =6 , osl::DR =7 , osl::SHORT8_DIRECTION_MAX =7 , osl::UUL =8 ,
  osl::UUR =9 , osl::LONG_DIRECTION_MIN =10 , osl::LONG_UL =10 , osl::LONG_U =11 ,
  osl::LONG_UR =12 , osl::LONG_L =13 , osl::LONG_R =14 , osl::LONG_DL =15 ,
  osl::LONG_D =16 , osl::LONG_DR =17 , osl::LONG_DIRECTION_MAX =17 , osl::DIRECTION_MIN =0 ,
  osl::SHORT_DIRECTION_MAX =9 , osl::SHORT_DIRECTION_SIZE =10 , osl::DIRECTION_MAX =17 , osl::DIRECTION_INVALID_VALUE =18 ,
  osl::DIRECTION_SIZE =18
}
 
enum  osl::Move16 { osl::MOVE16_NONE = 0 }
 16bit 表現 More...
 

Functions

constexpr Player osl::alt (Player player)
 
constexpr int osl::playerToIndex (Player player)
 
constexpr Player osl::indexToPlayer (int n)
 
constexpr int osl::sign (Player player)
 
constexpr int osl::playerToMask (Player player)
 
int osl::operator+ (Player, int)
 
int osl::operator+ (int, Player)
 
int osl::operator- (Player, int)
 
int osl::operator- (int, Player)
 
int osl::operator* (Player, int)
 
int osl::operator* (int, Player)
 
int osl::operator/ (Player, int)
 
int osl::operator/ (int, Player)
 
bool osl::isValid (Player player)
 cast等で作られたplayerが正しいかどうかを返す
 
std::ostream & osl::operator<< (std::ostream &os, Player player)
 
std::istream & osl::operator>> (std::istream &is, Ptype &ptype)
 
std::ostream & osl::operator<< (std::ostream &os, const Ptype ptype)
 
bool osl::isValid (Ptype ptype)
 int等からcastして作ったptypeが,正しい範囲に入っているかどうかのチェック
 
constexpr bool osl::isPiece (Ptype ptype)
 ptypeが空白やEDGEでないかのチェック
 
bool osl::isBasic (Ptype ptype)
 ptypeが基本型(promoteしていない)かのチェック
 
bool osl::isPromoted (Ptype ptype)
 ptypeがpromote後の型かどうかのチェック
 
bool osl::canPromote (Ptype ptype)
 ptypeがpromote可能な型かどうかのチェック promote済みの場合はfalseを返す
 
Ptype osl::unpromote (Ptype ptype)
 ptypeがpromote後の型の時に,promote前の型を返す. promoteしていない型の時はそのまま返す
 
constexpr Ptype osl::unpromoteSafe (Ptype ptype)
 
Ptype osl::promote (Ptype ptype)
 promote可能なptypeに対して,promote後の型を返す promote不可のptypeを与えてはいけない.
 
bool osl::isMajorBasic (Ptype ptype)
 
bool osl::isMajor (Ptype ptype)
 
bool osl::isMajorNonPieceOK (Ptype ptype)
 
unsigned int osl::ptypeOIndex (PtypeO ptypeo)
 
PtypeO osl::newPtypeO (Player player, Ptype ptype)
 
Ptype osl::getPtype (PtypeO ptypeO)
 
PtypeO osl::promote (PtypeO ptypeO)
 pieceをpromoteさせる.
 
PtypeO osl::promoteWithMask (PtypeO ptypeO, int promoteMask)
 pieceを引数次第でpromoteさせる
 
PtypeO osl::unpromote (PtypeO ptypeO)
 pieceをunpromoteさせる.
 
bool osl::isValidPtypeO (int ptypeO)
 
bool osl::isPiece (PtypeO ptypeO)
 EMPTY, EDGEではない
 
Player osl::getOwner (PtypeO ptypeO)
 
PtypeO osl::captured (PtypeO ptypeO)
 unpromoteすると共に,ownerを反転する.
 
PtypeO osl::alt (PtypeO ptypeO)
 owner を反転する
 
PtypeO osl::altIfPiece (PtypeO ptypeO)
 Pieceの時にはowner を反転する
 
bool osl::canPromote (PtypeO ptypeO)
 
bool osl::isPromoted (PtypeO ptypeO)
 ptypeOが promote済みかどうか
 
const PtypeO PTYPEO_EDGE osl::__attribute__ ((unused))
 
std::ostream & osl::operator<< (std::ostream &os, const PtypeO ptypeO)
 
constexpr bool osl::isShort (Direction d)
 
constexpr bool osl::isShort8 (Direction d)
 
constexpr bool osl::isLong (Direction d)
 
constexpr Direction osl::inverseUnsafe (Direction d)
 
constexpr Direction osl::inverse (Direction d)
 
constexpr Direction osl::primDir (Direction d)
 8方向について,primitiveな4方向を求める
 
constexpr Direction osl::primDirUnsafe (Direction d)
 8方向について,primitiveな4方向を求める dとしてknight, INVALIDなども来る
 
bool osl::isValid (Direction d)
 
constexpr Direction osl::longToShort (Direction d)
 
constexpr Direction osl::shortToLong (Direction d)
 引数に longDirを与えてはいけない
 
constexpr int osl::dirToMask (Direction dir)
 
std::ostream & osl::operator<< (std::ostream &os, const Direction d)
 
bool osl::operator== (Square l, Square r)
 
Offset osl::newOffset (int dx, int dy)
 @obsolete
 
bool osl::operator== (Offset l, Offset r)
 
bool osl::operator!= (Offset l, Offset r)
 
bool osl::operator< (Offset l, Offset r)
 
std::ostream & osl::operator<< (std::ostream &, Offset)
 
bool osl::operator!= (Square l, Square r)
 
bool osl::operator< (Square l, Square r)
 
bool osl::operator> (Square l, Square r)
 
std::ostream & osl::operator<< (std::ostream &, Square)
 
bool osl::operator== (Piece l, Piece r)
 
bool osl::operator< (Piece l, Piece r)
 
bool osl::operator!= (Piece l, Piece r)
 
std::ostream & osl::operator<< (std::ostream &os, const Piece piece)
 
bool osl::operator< (Move lhs, Move rhs)
 
bool osl::operator== (Move lhs, Move rhs)
 
bool osl::operator!= (Move lhs, Move rhs)
 
std::ostream & osl::operator<< (std::ostream &os, Move move)
 

Variables

const int osl::PTYPE_SIZE =PTYPE_MAX-PTYPE_MIN+1
 
const PtypeO osl::PTYPEO_EMPTY =newPtypeO(BLACK,PTYPE_EMPTY)
 
const int osl::PTYPEO_SIZE =PTYPEO_MAX-PTYPEO_MIN+1
 
const int osl::EMPTY_NUM =0x80
 
const int osl::EDGE_NUM =0x40
 

Macro Definition Documentation

◆ move_assert

#define move_assert (   x)

move 関係でつかまえ所のないエラーがでるときに定義する

Definition at line 1013 of file basic_type.h.

◆ NEW_PTYPEO

#define NEW_PTYPEO (   player,
  ptype 
)    static_cast<PtypeO>(static_cast<int>(ptype)-(16&static_cast<int>(player)))

Definition at line 204 of file basic_type.h.