threadForEachMove.h
Go to the documentation of this file.
00001 /* threadForEachMove.h
00002  */
00003 #ifndef OSL_THREADFOREACHMOVE_H
00004 #define OSL_THREADFOREACHMOVE_H
00005 
00006 #include "osl/game_playing/computerPlayer.h"
00007 #include "osl/game_playing/speculativeModel.h"
00008 #include <boost/shared_ptr.hpp>
00009 #include <boost/scoped_ptr.hpp>
00010 
00011 namespace osl
00012 {
00013   namespace game_playing
00014   {
00015     class SearchPlayer;
00019     class ThreadForEachMove : public SpeculativeModel
00020     {
00021       struct SpeculativeThread;
00022       boost::scoped_ptr<SpeculativeThread> speculative_thread0;
00023       boost::scoped_ptr<SpeculativeThread> speculative_thread1;
00024       int max_threads;
00025     public:
00026       explicit ThreadForEachMove(int max_threads=1);
00027       ~ThreadForEachMove();
00028 
00029       void setMaxThreads(int new_max_threads)
00030       {
00031         max_threads = new_max_threads;
00032       }
00033       void startSpeculative(const boost::shared_ptr<GameState> state,
00034                             const SearchPlayer& main_player);
00035       void stopOtherThan(Move);
00036       void stopAll();
00037 
00038       const MoveWithComment waitResult(Move last_move, int wait_for,
00039                                        SearchPlayer& main_player, int);
00040 
00041       void selectBestMoveCleanUp();
00042     };
00043   } // game_playing
00044 } // osl
00045 
00046 #endif /* OSL_THREADFOREACHMOVE_H */
00047 // ;;; Local Variables:
00048 // ;;; mode:c++
00049 // ;;; c-basic-offset:2
00050 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines