Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

HexEval.cpp

Go to the documentation of this file.
00001 //----------------------------------------------------------------------------
00002 /** @file
00003  */
00004 //----------------------------------------------------------------------------
00005 
00006 #include "Hex.hpp"
00007 #include "HexEval.hpp"
00008 #include "HexBoard.hpp"
00009 
00010 using namespace benzene;
00011 
00012 //----------------------------------------------------------------------------
00013 
00014 bool HexEvalUtil::IsValidEval(HexEval ev)
00015 {
00016     return (ev >= IMMEDIATE_LOSS && ev <= IMMEDIATE_WIN);
00017 }
00018 
00019 bool HexEvalUtil::IsWin(HexEval ev)
00020 {
00021     HexAssert(IsValidEval(ev));
00022     return ev >= WIN_THRESHOLD;
00023 }
00024 
00025 int HexEvalUtil::PlyToWin(HexEval ev)
00026 {
00027     HexAssert(IsValidEval(ev));
00028     return (int)(IMMEDIATE_WIN - ev);
00029 }
00030 
00031 bool HexEvalUtil::IsLoss(HexEval ev)
00032 {
00033     HexAssert(IsValidEval(ev));
00034     return ev <= LOSS_THRESHOLD;
00035 }
00036 
00037 int HexEvalUtil::PlyToLoss(HexEval ev)
00038 {
00039     HexAssert(IsValidEval(ev));
00040     return (int)(ev - IMMEDIATE_LOSS);
00041 }
00042 
00043 bool HexEvalUtil::IsWinOrLoss(HexEval ev)
00044 {
00045     return IsWin(ev) || IsLoss(ev);
00046 }
00047 
00048 //----------------------------------------------------------------------------


6 Jan 2011 Doxygen 1.6.3