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