Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

SpMoveGenerator.h

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


Sun Mar 13 2011 Doxygen 1.7.1