Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

SpDumbTacticalPlayer.h

Go to the documentation of this file.
00001 //----------------------------------------------------------------------------
00002 /** @file SpDumbTacticalPlayer.h
00003     Dumb tactical player */
00004 //----------------------------------------------------------------------------
00005 
00006 #ifndef SP_DUMBTACTICALPLAYER_H
00007 #define SP_DUMBTACTICALPLAYER_H
00008 
00009 #include "SpSimplePlayer.h"
00010 #include "SpMoveGenerator.h"
00011 
00012 //----------------------------------------------------------------------------
00013 
00014 /** Plays mostly to extend/reduce liberties.
00015     Plays the following, in priority order:
00016     1. If own group has single liberty, play there
00017     2. Amongst opponent groups without two eyes, find the one with the least
00018        libs, and fill the one with the most second order liberties. If there
00019        is a tie pick one at random.
00020     3. Make a random move that doesn't fill own eye
00021     4. Pass */
00022 class SpDumbTacticalMoveGenerator
00023     : public SpStaticMoveGenerator
00024 {
00025 public:
00026     explicit SpDumbTacticalMoveGenerator(const GoBoard& board);
00027     
00028     virtual void GenerateMoves(SgEvaluatedMoves& eval, SgBlackWhite toPlay);
00029 
00030     virtual bool ExecuteMoveForScoring()
00031     {
00032         return false;
00033     }
00034 
00035     virtual int Score(SgPoint p);
00036 
00037 private:
00038     bool m_useLadders;
00039     
00040     void GenerateAttackMoves(SgEvaluatedMoves& eval);
00041 
00042     void GenerateDefendMoves(SgEvaluatedMoves& eval);
00043 };
00044 
00045 //----------------------------------------------------------------------------
00046 
00047 /** A SpSimplePlayer using the SpDumbTacticalMoveGenerator */
00048 class SpDumbTacticalPlayer
00049     : public SpSimplePlayer
00050 {
00051 public:
00052     SpDumbTacticalPlayer(const GoBoard& board)
00053         : SpSimplePlayer(board, new SpDumbTacticalMoveGenerator(board))
00054     { }
00055     
00056     std::string Name() const
00057     {
00058         return "DumbTactical";
00059     }
00060 };
00061 
00062 //----------------------------------------------------------------------------
00063 
00064 #endif // SP_DUMBTACTICALPLAYER_H
00065 


Sun Mar 13 2011 Doxygen 1.7.1