public GameService(IGameRepository gameRepository, IJudge judge, IGameBuilder gameBuilder, ICPUPlayer cpuPlayer)
 {
     this.gameRepository = gameRepository;
     this.judge          = judge;
     this.gameBuilder    = gameBuilder;
     this.cpuPlayer      = cpuPlayer;
 }
Beispiel #2
0
        /// <summary>
        /// Run the quality benchmark.
        /// </summary>
        /// <param name="judge">
        /// The judge that can tell if a certain result doc is relevant for a certain quality query.
        /// If null, no judgements would be made. Usually null for a submission run.
        /// </param>
        /// <param name="submitRep">Submission report is created if non null.</param>
        /// <param name="qualityLog">If not null, quality run data would be printed for each query.</param>
        /// <returns><see cref="QualityStats"/> of each quality query that was executed.</returns>
        /// <exception cref="Exception">If quality benchmark failed to run.</exception>
        public virtual QualityStats[] Execute(IJudge judge, SubmissionReport submitRep,
                                              TextWriter qualityLog)
        {
            int nQueries = Math.Min(maxQueries, m_qualityQueries.Length);

            QualityStats[] stats = new QualityStats[nQueries];
            for (int i = 0; i < nQueries; i++)
            {
                QualityQuery qq = m_qualityQueries[i];
                // generate query
                Query q = m_qqParser.Parse(qq);
                // search with this query
                long    t1         = J2N.Time.NanoTime() / J2N.Time.MillisecondsPerNanosecond;        // LUCENENET: Use NanoTime() rather than CurrentTimeMilliseconds() for more accurate/reliable results
                TopDocs td         = m_searcher.Search(q, null, maxResults);
                long    searchTime = (J2N.Time.NanoTime() / J2N.Time.MillisecondsPerNanosecond) - t1; // LUCENENET: Use NanoTime() rather than CurrentTimeMilliseconds() for more accurate/reliable results
                //most likely we either submit or judge, but check both
                if (judge != null)
                {
                    stats[i] = AnalyzeQueryResults(qq, q, td, judge, qualityLog, searchTime);
                }
                if (submitRep != null)
                {
                    submitRep.Report(qq, td, m_docNameField, m_searcher);
                }
            }
            if (submitRep != null)
            {
                submitRep.Flush();
            }
            return(stats);
        }
Beispiel #3
0
 public GobangGame(IBoardFactory boardFactory, IPlayer p1, IPlayer p2, IJudge judge)
 {
     this.boardFactory = boardFactory;
     this.player1      = p1;
     this.player2      = p2;
     this.judge        = judge;
 }
        public TurnLogic(MainBackground mainBackground, IJudge judge, ISocketConnection socketConnection, IControlsMapping controlsMappins, IControlsRepository controlsRepository)
        {
            _mainBackground     = mainBackground;
            _judge              = judge;
            _socketConnection   = socketConnection;
            _controlsMappings   = controlsMappins;
            _controlsRepository = controlsRepository;

            _socketConnection.SetEnemyMoveAction(EnemyMove);
            _judge.GameOver      = GameOver;
            _imagesContainerPath = (Directory.GetCurrentDirectory().GetDirectoryName(2) + @"\ImagesContainer\");
        }
Beispiel #5
0
 public AbPruningAi(PieceType player,
                    int maxDepth,
                    IScorer scorer,
                    IMoveEnumerator moveEnumerator,
                    IBoardFactory boardFactory,
                    IJudge judge)
 {
     this.player         = player;
     this.maxDepth       = maxDepth;
     this.scorer         = scorer;
     this.moveEnumerator = moveEnumerator;
     this.boardFactory   = boardFactory;
     this.judge          = judge;
 }
Beispiel #6
0
        /// <summary>Analyze/judge results for a single quality query; optionally log them.</summary>
        private QualityStats AnalyzeQueryResults(QualityQuery qq, Query q, TopDocs td, IJudge judge, TextWriter logger, long searchTime)
        {
            QualityStats stts = new QualityStats(judge.MaxRecall(qq), searchTime);

            ScoreDoc[] sd = td.ScoreDocs;
            // LUCENENET: Use NanoTime() rather than CurrentTimeMilliseconds() for more accurate/reliable results
            long             t1 = J2N.Time.NanoTime() / J2N.Time.MillisecondsPerNanosecond; // extraction of first doc name we measure also construction of doc name extractor, just in case.
            DocNameExtractor xt = new DocNameExtractor(m_docNameField);

            for (int i = 0; i < sd.Length; i++)
            {
                string docName            = xt.DocName(m_searcher, sd[i].Doc);
                long   docNameExtractTime = (J2N.Time.NanoTime() / J2N.Time.MillisecondsPerNanosecond) - t1; // LUCENENET: Use NanoTime() rather than CurrentTimeMilliseconds() for more accurate/reliable results
                t1 = J2N.Time.NanoTime() / J2N.Time.MillisecondsPerNanosecond;                               // LUCENENET: Use NanoTime() rather than CurrentTimeMilliseconds() for more accurate/reliable results
                bool isRelevant = judge.IsRelevant(docName, qq);
                stts.AddResult(i + 1, isRelevant, docNameExtractTime);
            }
            if (logger != null)
            {
                logger.WriteLine(qq.QueryID + "  -  " + q);
                stts.Log(qq.QueryID + " Stats:", 1, logger, "  ");
            }
            return(stts);
        }
Beispiel #7
0
 public void TestSetUp()
 {
     this.judge = new Judge();
     this.idGen = new Random();
 }
Beispiel #8
0
 public Game(IBoard board, IPlayer player, IJudge judge)
 {
     _board  = board;
     _player = player;
     _judge  = judge;
 }
 public IGame CreateGame(IBoardFactory boardFactory, IPlayer p1, IPlayer p2, IJudge judge)
 {
     return(new GobangGame(boardFactory, p1, p2, judge));
 }
Beispiel #10
0
 public Judgment(IJudge judge, IDecision project)
 {
     m_judge       = judge;
     m_project     = project;
     m_Comparisons = new List <IComparison>();
 }
Beispiel #11
0
 /// <summary>
 /// Constructor de una ronda "round"
 /// Patrón Creator, al crear una ronda se crea una lista de cartas.
 /// </summary>
 /// <param name="judge">juez</param>
 /// <param name="blackCard">carta negra</param>
 public Round(IJudge judge, Card blackCard)
 {
     this.judge           = judge;
     BlackCard            = blackCard;
     listWhiteCardsAnswer = new List <Card>();
 }