00001 //---------------------------------------------------------------------------- 00002 /** @file SgMove.h 00003 Definitions for game-independent moves. 00004 Useful for games that can encode moves as positive integers (including 0). 00005 Negative integers are reserved for special meanings, like pass or null 00006 move and defined in this file. 00007 Don't make an assumption about the exact values of the special moves 00008 (apart that they are negative). If you do, at least document it with 00009 a static assertion. 00010 Classes that can work with moves of different games should only include 00011 this header. 00012 */ 00013 //---------------------------------------------------------------------------- 00014 00015 #ifndef SG_MOVE_H 00016 #define SG_MOVE_H 00017 00018 //---------------------------------------------------------------------------- 00019 00020 typedef int SgMove; 00021 00022 /** A null move is an uninitialized move, not legal to execute. 00023 Not the same as a pass move or a null move in null-move-search. 00024 */ 00025 const SgMove SG_NULLMOVE = -1; 00026 00027 /** Used for coupon search. 00028 Indicates that no move was made in the game, but a coupon taken from 00029 the coupon stack. 00030 */ 00031 const SgMove SG_COUPONMOVE = -2; 00032 00033 /** Used for coupon search. 00034 Indicates that no move was made in the game, but a virtual coupon taken 00035 from the coupon stack. 00036 */ 00037 const SgMove SG_COUPONMOVE_VIRTUAL = -3; 00038 00039 /** Resign. */ 00040 const SgMove SG_RESIGN = -4; 00041 00042 //---------------------------------------------------------------------------- 00043 00044 namespace SgMoveUtil 00045 { 00046 /** Is move SG_COUPONMOVE or SG_COUPONMOVE_VIRTUAL? */ 00047 bool IsCouponMove(SgMove move); 00048 } 00049 00050 inline bool SgMoveUtil::IsCouponMove(SgMove move) 00051 { 00052 return (move == SG_COUPONMOVE || move == SG_COUPONMOVE_VIRTUAL); 00053 } 00054 00055 //---------------------------------------------------------------------------- 00056 00057 #endif // SG_MOVE_H