All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Namespaces | Constant Groups | Macros | Enumerations | Functions | Variables
ptype.h File Reference
#include "osl/config.h"
#include "osl/player.h"
#include <cassert>
#include <iosfwd>
Include dependency graph for ptype.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 osl
 attackDefense.h
 

Constant Groups

 osl
 attackDefense.h
 

Macros

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

Enumerations

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...
 

Functions

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が,正しい範囲に入っているかどうかのチェック More...
 
bool osl::isPiece (Ptype ptype)
 ptypeが空白やEDGEでないかのチェック More...
 
bool osl::isBasic (Ptype ptype)
 ptypeが基本型(promoteしていない)かのチェック More...
 
bool osl::isPromoted (Ptype ptype)
 ptypeがpromote後の型かどうかのチェック More...
 
bool osl::canPromote (Ptype ptype)
 ptypeがpromote可能な型かどうかのチェック promote済みの場合はfalseを返す More...
 
Ptype osl::unpromote (Ptype ptype)
 ptypeがpromote後の型の時に,promote前の型を返す. promoteしていない型の時はそのまま返す More...
 
Ptype osl::unpromoteSafe (Ptype ptype)
 
Ptype osl::promote (Ptype ptype)
 promote可能なptypeに対して,promote後の型を返す promote不可のptypeを与えてはいけない. More...
 
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させる. More...
 
PtypeO osl::promoteWithMask (PtypeO ptypeO, int promoteMask)
 pieceを引数次第でpromoteさせる More...
 
PtypeO osl::unpromote (PtypeO ptypeO)
 pieceをunpromoteさせる. More...
 
bool osl::isValidPtypeO (int ptypeO)
 
bool osl::isPiece (PtypeO ptypeO)
 EMPTY, EDGEではない More...
 
Player osl::getOwner (PtypeO ptypeO)
 
PtypeO osl::captured (PtypeO ptypeO)
 unpromoteすると共に,ownerを反転する. More...
 
PtypeO osl::alt (PtypeO ptypeO)
 owner を反転する More...
 
PtypeO osl::altIfPiece (PtypeO ptypeO)
 Pieceの時にはowner を反転する More...
 
bool osl::canPromote (PtypeO ptypeO)
 
bool osl::isPromoted (PtypeO ptypeO)
 ptypeOが promote済みかどうか More...
 
std::ostream & osl::operator<< (std::ostream &os, const PtypeO ptypeO)
 

Variables

const int osl::PTYPE_SIZE =PTYPE_MAX-PTYPE_MIN+1
 
const PtypeO osl::PTYPEO_EMPTY =newPtypeO(BLACK,PTYPE_EMPTY)
 
const PtypeO osl::PTYPEO_EDGE =newPtypeO(WHITE,PTYPE_EDGE)
 
const int osl::PTYPEO_SIZE =PTYPEO_MAX-PTYPEO_MIN+1
 

Macro Definition Documentation

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