usiReporter.h
Go to the documentation of this file.
00001 /* usiReporter.h
00002  */
00003 #ifndef OSL_USIREPORTER_H
00004 #define OSL_USIREPORTER_H
00005 #include "osl/search/searchMonitor.h"
00006 #include "osl/misc/milliSeconds.h"
00007 #include <boost/asio/ip/udp.hpp>
00008 #include <iosfwd>
00009 
00010 namespace osl
00011 {
00012   namespace search
00013   {
00014     struct UsiReporter
00015     {
00016       static void newDepth(std::ostream& os, int depth);
00017       static void showPV(std::ostream& os, int depth, size_t node_count, double elapsed, int value, Move cur, const Move *first, const Move *last, bool ignore_silent=false);
00018       static void showPVExtended(std::ostream& os, int depth, size_t node_count, double elapsed, int value, Move cur, const Move *first, const Move *last,
00019                                  const bool *threatmate_first, const bool *threatmate_last);
00020       static void rootMove(std::ostream& os, Move cur, bool allow_frequent_display=false);
00021       static void timeInfo(std::ostream& os, size_t node_count, double elapsed);
00022       static void hashInfo(std::ostream& os, double ratio);
00023     };
00024 
00025     class UsiMonitor : public SearchMonitor
00026     {
00027       Move last_root_move;
00028       std::string deferred;
00029       double silent_period;
00030       bool extended;
00031       MilliSeconds depth0;
00032       std::ostream& os;
00033       boost::asio::ip::udp::socket *udp_socket;
00034       boost::asio::ip::udp::endpoint *udp_endpoint;
00035       std::string client_id;
00036     public:
00037       UsiMonitor(bool extended, std::ostream& os, double silent=0.5);
00038       ~UsiMonitor();
00039       void setUdpLogging(std::string& udp_client_id,
00040                          boost::asio::ip::udp::socket *,
00041                          boost::asio::ip::udp::endpoint *);
00042       void newDepth(int depth);
00043       void showPV(int depth, size_t node_count, double elapsed, int value, Move cur, const Move *first, const Move *last,
00044                   const bool *threatmate_first, const bool *threatmate_last);
00045       void showFailLow(int depth, size_t node_count, double elapsed,
00046                        int value, Move cur);
00047       void rootMove(Move cur);
00048       void rootFirstMove(Move cur);
00049       void timeInfo(size_t node_count, double elapsed);
00050       void hashInfo(double ratio);
00051       void rootForcedMove(Move the_move);
00052       void rootLossByCheckmate();
00053       void searchFinished();
00054     private:
00055       void showDeferred(bool forced=false);
00056     };
00057   }
00058   using search::UsiMonitor;
00059 }
00060 
00061 
00062 #endif /* OSL_USIREPORTER_H */
00063 // ;;; Local Variables:
00064 // ;;; mode:c++
00065 // ;;; c-basic-offset:2
00066 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines