00001 //---------------------------------------------------------------------------- 00002 /** @file SpMoveGenerator.h 00003 Simple move generator for simple players 00004 */ 00005 //---------------------------------------------------------------------------- 00006 00007 #ifndef SP_MOVEGENERATOR_H 00008 #define SP_MOVEGENERATOR_H 00009 00010 #include "GoBoard.h" 00011 00012 class SgEvaluatedMoves; 00013 00014 //---------------------------------------------------------------------------- 00015 00016 /** Simple move generators. 00017 Either static or 1-ply lookahead 00018 */ 00019 class SpMoveGenerator 00020 { 00021 public: 00022 explicit SpMoveGenerator(GoBoard& board) 00023 : m_board(board) 00024 { } 00025 00026 virtual ~SpMoveGenerator() { } 00027 00028 virtual void GenerateMoves(SgEvaluatedMoves& eval, SgBlackWhite toPlay); 00029 00030 /** Execute move if necessary, and then score */ 00031 virtual int EvaluateMove(SgPoint p) = 0; 00032 00033 protected: 00034 /** Reference to go board on which to play */ 00035 GoBoard& m_board; 00036 00037 /** Not implemented */ 00038 SpMoveGenerator(const SpMoveGenerator&); 00039 00040 /** Not implemented */ 00041 SpMoveGenerator& operator=(const SpMoveGenerator&); 00042 }; 00043 00044 /** Statically assigns a value to a given move */ 00045 class SpStaticMoveGenerator 00046 : public SpMoveGenerator 00047 { 00048 public: 00049 explicit SpStaticMoveGenerator(GoBoard& board) 00050 : SpMoveGenerator(board) 00051 { } 00052 00053 virtual int Score(SgPoint p) = 0; 00054 00055 /** Static move evaluation */ 00056 int EvaluateMove(SgPoint p); 00057 }; 00058 00059 /** Evaluates move by executing it, then evaluating the board */ 00060 class Sp1PlyMoveGenerator 00061 : public SpMoveGenerator 00062 { 00063 public: 00064 explicit Sp1PlyMoveGenerator(GoBoard& board) 00065 : SpMoveGenerator(board) 00066 { } 00067 00068 virtual int Evaluate() = 0; 00069 00070 /** Execute move, then evaluate board */ 00071 int EvaluateMove(SgPoint p); 00072 }; 00073 00074 //---------------------------------------------------------------------------- 00075 00076 #endif // SP_MOVEGENERATOR_H 00077