00001 //---------------------------------------------------------------------------- 00002 /** @file SpAveragePlayer.h 00003 Average liberty player */ 00004 //---------------------------------------------------------------------------- 00005 00006 #ifndef SP_AVERAGEPLAYER_H 00007 #define SP_AVERAGEPLAYER_H 00008 00009 #include <string> 00010 #include "SpSimplePlayer.h" 00011 #include "SpMoveGenerator.h" 00012 00013 //---------------------------------------------------------------------------- 00014 00015 /** Tries to maximize liberty average of own minus opponent blocks. 00016 Tends to build long chains with many liberties and some eyes. 00017 The strongest of the original simple players. */ 00018 class SpAverageMoveGenerator 00019 : public Sp1PlyMoveGenerator 00020 { 00021 public: 00022 explicit SpAverageMoveGenerator(const GoBoard& board) 00023 : Sp1PlyMoveGenerator(board) 00024 { } 00025 00026 int Evaluate(); 00027 }; 00028 00029 //---------------------------------------------------------------------------- 00030 00031 /** Simple player using SpAverageMoveGenerator */ 00032 class SpAveragePlayer 00033 : public SpSimplePlayer 00034 { 00035 public: 00036 SpAveragePlayer(const GoBoard& board) 00037 : SpSimplePlayer(board, new SpAverageMoveGenerator(board)) 00038 { } 00039 00040 std::string Name() const 00041 { 00042 return "AverageLib"; 00043 } 00044 00045 bool UseFilter() const 00046 { 00047 return true; 00048 } 00049 }; 00050 00051 //---------------------------------------------------------------------------- 00052 00053 /** Average number of liberties of blocks of color, multiplied by 10 */ 00054 int LibertyAveragex10(const GoBoard& board, SgBlackWhite color); 00055 00056 //---------------------------------------------------------------------------- 00057 00058 #endif 00059