00001 //---------------------------------------------------------------------------- 00002 /** @file SpMinLibPlayer.h 00003 Minimum liberty player - blocks with fewest liberties are most urgent. 00004 */ 00005 //---------------------------------------------------------------------------- 00006 00007 #ifndef SP_MINLIBPLAYER_H 00008 #define SP_MINLIBPLAYER_H 00009 00010 #include "SpSimplePlayer.h" 00011 #include "SpMoveGenerator.h" 00012 00013 00014 //---------------------------------------------------------------------------- 00015 00016 /** Tries to maximize minimum liberty of own minus opponent blocks. 00017 */ 00018 class SpMinLibMoveGenerator 00019 : public Sp1PlyMoveGenerator 00020 { 00021 public: 00022 explicit SpMinLibMoveGenerator(GoBoard& board) 00023 : Sp1PlyMoveGenerator(board) 00024 { } 00025 00026 virtual int Evaluate(); 00027 00028 int LibertyMinimum(SgBlackWhite toplay); 00029 }; 00030 00031 //---------------------------------------------------------------------------- 00032 00033 /** Simple player using SpMinLibMoveGenerator */ 00034 class SpMinLibPlayer 00035 : public SpSimplePlayer 00036 { 00037 public: 00038 SpMinLibPlayer(GoBoard& board) 00039 : SpSimplePlayer(board, new SpMinLibMoveGenerator(board)) 00040 { } 00041 00042 std::string Name() const 00043 { 00044 return "MinLib"; 00045 } 00046 00047 bool UseFilter() const 00048 { 00049 return true; 00050 } 00051 }; 00052 00053 #endif 00054