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