Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

SgMove.h

Go to the documentation of this file.
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 #ifndef SG_MOVE_H
00015 #define SG_MOVE_H
00016 
00017 //----------------------------------------------------------------------------
00018 
00019 typedef int SgMove;
00020 
00021 /** A null move is an uninitialized move, not legal to execute.
00022     Not the same as a pass move or a null move in null-move-search. */
00023 const SgMove SG_NULLMOVE = -1;
00024 
00025 /** Used for coupon search.
00026     Indicates that no move was made in the game, but a coupon taken from
00027     the coupon stack. */
00028 const SgMove SG_COUPONMOVE = -2;
00029 
00030 /** Used for coupon search.
00031     Indicates that no move was made in the game, but a virtual coupon taken
00032     from the coupon stack. */
00033 const SgMove SG_COUPONMOVE_VIRTUAL = -3;
00034 
00035 /** Resign. */
00036 const SgMove SG_RESIGN = -4;
00037 
00038 //----------------------------------------------------------------------------
00039 
00040 namespace SgMoveUtil
00041 {
00042     /** Is move SG_COUPONMOVE or SG_COUPONMOVE_VIRTUAL? */
00043     bool IsCouponMove(SgMove move);
00044 }
00045 
00046 inline bool SgMoveUtil::IsCouponMove(SgMove move)
00047 {
00048     return (move == SG_COUPONMOVE || move == SG_COUPONMOVE_VIRTUAL);
00049 }
00050 
00051 //----------------------------------------------------------------------------
00052 
00053 #endif // SG_MOVE_H


Sun Mar 13 2011 Doxygen 1.7.1