Ejemplo n.º 1
0
 public new void SetNagCoordinator(NagCoordinator nagCoordinator)
 {
     if (nagCoordinator != null)                 // hack!
     {
         NagCoordinator = nagCoordinator;
     }
 }
Ejemplo n.º 2
0
 public WorkerProxy(NagCoordinator coordinator, Socket socket)
 {
     Worker = new TCPConnection(socket, false, ProcesLine, null);
     NagCoordinator = coordinator;
     State = ConnectionState.Negotiating;
     Negotiate();
 }
Ejemplo n.º 3
0
        public new void Initialize(GoBoard goBoard, Color playerToMove, SearchOptions searchOptions, OnCompletion onCompletion)
        {
            base.Initialize(goBoard, playerToMove, searchOptions, onCompletion);

            // setup distributed search coordinator & initialize workers
            if (NagCoordinator == null)
            {
                NagCoordinator = new NagCoordinator(9999, SearchOptions.PatternDetector.Patterns);                      // default port
            }
            NagCoordinator.SetNagCallBack(SetNag);
            NagCoordinator.Initialize(goBoard);

            if (TranspositionTable == null)
            {
                TranspositionTablePrimary = new TranspositionTablePlus(SearchOptions.TranspositionTableSize);
            }
            else
            if (TranspositionTable.Size != SearchOptions.TranspositionTableSize)
            {
                TranspositionTablePrimary = new TranspositionTablePlus(SearchOptions.TranspositionTableSize);
            }

            if (TranspositionTableEndGame == null)
            {
                TranspositionTableEndGame = new TranspositionTablePlus(1024 * 1024);
            }

            TranspositionTable = TranspositionTablePrimary;
        }
Ejemplo n.º 4
0
 public WorkerProxy(NagCoordinator coordinator, Socket socket)
 {
     Worker         = new TCPConnection(socket, false, ProcesLine, null);
     NagCoordinator = coordinator;
     State          = ConnectionState.Negotiating;
     Negotiate();
 }
Ejemplo n.º 5
0
        // temp. for testing
        /// <summary>
        /// Launches the test.
        /// </summary>
        /// <returns></returns>
        public static int LaunchTest2()
        {
            GoBoard    lGoBoard    = new GoBoard(9);
            GameRecord lGameRecord = new GameRecord();

            SGFCollection lSGFCollection = new SGFCollection();

            lSGFCollection.LoadSGFFromMemory(SGFGameSamples.DYER);
            lSGFCollection.RetrieveGame(lGameRecord);
            GameRecordBoardAdapter.Apply(lGameRecord, lGoBoard, false);

            lGoBoard.Dump();

            PatternCollection lPatternCollection = new PatternCollection(@"Patterns\test.db");

            NagCoordinator lNagCoordinator = new NagCoordinator(9999, lPatternCollection);

            lNagCoordinator.Initialize(lGoBoard);
            ThreadPoolHelperWithParam <int> .Execute(LaunchWorker, 9999);

            ThreadPoolHelperWithParam <int> .Execute(LaunchWorker, 9999);

            ThreadPoolHelperWithParam <int> .Execute(LaunchWorker, 9999);

            ThreadPoolHelperWithParam <int> .Execute(LaunchWorker, 9999);

            Thread.Sleep(1000 * 1);

            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);
            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);
            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);
            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);
            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);
            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);
            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);
            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);
            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);
            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);
            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);
            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);
            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);
            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);


            Thread.Sleep(1000 * 300);

            return(0);
        }
Ejemplo n.º 6
0
        // temp. for testing
        /// <summary>
        /// Launches the test.
        /// </summary>
        /// <returns></returns>
        public static int LaunchTest()
        {
            GoBoard    lGoBoard    = new GoBoard(9);
            GameRecord lGameRecord = new GameRecord();

            SGFCollection lSGFCollection = new SGFCollection();

            //lSGFCollection.LoadSGFFromMemory(SGFGameSamples.DYER);
//			lSGFCollection.LoadSGFFile(@"x:\CodePlex\test2.sgf");
//			lSGFCollection.RetrieveGame(lGameRecord);
//			GameRecordBoardAdapter.Apply(lGameRecord, lGoBoard, false);

            lGoBoard.Dump();

            PatternCollection lPatternCollection = new PatternCollection(@"Patterns\test.db");

            NagCoordinator lNagCoordinator = new NagCoordinator(9999, lPatternCollection);

            //ThreadPoolHelperWithParam<int>.Execute(LaunchWorker, 9999);

            Thread.Sleep(1000 * 14);

            SearchEngine lSearchEngine = new SearchEngine(lGoBoard);

            lSearchEngine.SetSearchMethod(SearchMethodType.AlphaBeta_NAG_ID_TT);
            lSearchEngine.SetNagCoordinator(lNagCoordinator);
            lSearchEngine.SearchOptions.MaxPly          = 40;
            lSearchEngine.SearchOptions.MaxSeconds      = 2000;
            lSearchEngine.SearchOptions.PatternDetector = new PatternDetector(lPatternCollection);

            lSearchEngine.SimpleSearch(Color.Black);

            Thread.Sleep(1000 * 10);

            return(0);
        }
Ejemplo n.º 7
0
        // temp. for testing
        /// <summary>
        /// Launches the test.
        /// </summary>
        /// <returns></returns>
        public static int LaunchTest2()
        {
            GoBoard lGoBoard = new GoBoard(9);
            GameRecord lGameRecord = new GameRecord();

            SGFCollection lSGFCollection = new SGFCollection();
            lSGFCollection.LoadSGFFromMemory(SGFGameSamples.DYER);
            lSGFCollection.RetrieveGame(lGameRecord);
            GameRecordBoardAdapter.Apply(lGameRecord, lGoBoard, false);

            lGoBoard.Dump();

            PatternCollection lPatternCollection = new PatternCollection(@"Patterns\test.db");

            NagCoordinator lNagCoordinator = new NagCoordinator(9999, lPatternCollection);

            lNagCoordinator.Initialize(lGoBoard);
            ThreadPoolHelperWithParam<int>.Execute(LaunchWorker, 9999);
            ThreadPoolHelperWithParam<int>.Execute(LaunchWorker, 9999);
            ThreadPoolHelperWithParam<int>.Execute(LaunchWorker, 9999);
            ThreadPoolHelperWithParam<int>.Execute(LaunchWorker, 9999);
            Thread.Sleep(1000 * 1);

            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);
            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);
            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);
            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);
            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);
            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);
            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);
            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);
            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);
            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);
            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);
            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);
            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);
            lNagCoordinator.CreateNagPoints(lGoBoard, -10000, 10000, Color.Black, 30, 0, 0, 1);

            Thread.Sleep(1000 * 300);

            return 0;
        }
Ejemplo n.º 8
0
        // temp. for testing
        /// <summary>
        /// Launches the test.
        /// </summary>
        /// <returns></returns>
        public static int LaunchTest()
        {
            GoBoard lGoBoard = new GoBoard(9);
            GameRecord lGameRecord = new GameRecord();

            SGFCollection lSGFCollection = new SGFCollection();
            //lSGFCollection.LoadSGFFromMemory(SGFGameSamples.DYER);
            //			lSGFCollection.LoadSGFFile(@"x:\CodePlex\test2.sgf");
            //			lSGFCollection.RetrieveGame(lGameRecord);
            //			GameRecordBoardAdapter.Apply(lGameRecord, lGoBoard, false);

            lGoBoard.Dump();

            PatternCollection lPatternCollection = new PatternCollection(@"Patterns\test.db");

            NagCoordinator lNagCoordinator = new NagCoordinator(9999, lPatternCollection);

            //ThreadPoolHelperWithParam<int>.Execute(LaunchWorker, 9999);

            Thread.Sleep(1000 * 14);

            SearchEngine lSearchEngine = new SearchEngine(lGoBoard);

            lSearchEngine.SetSearchMethod(SearchMethodType.AlphaBeta_NAG_ID_TT);
            lSearchEngine.SetNagCoordinator(lNagCoordinator);
            lSearchEngine.SearchOptions.MaxPly = 40;
            lSearchEngine.SearchOptions.MaxSeconds = 2000;
            lSearchEngine.SearchOptions.PatternDetector = new PatternDetector(lPatternCollection);

            lSearchEngine.SimpleSearch(Color.Black);

            Thread.Sleep(1000 * 10);

            return 0;
        }
Ejemplo n.º 9
0
 public void SetNagCoordinator(NagCoordinator nagCoordinator)
 {
     NagCoordinator = nagCoordinator;
 }
Ejemplo n.º 10
0
 public void SetNagCoordinator(NagCoordinator nagCoordinator)
 {
 }
Ejemplo n.º 11
0
 public void SetNagCoordinator(NagCoordinator nagCoordinator)
 {
     Search.SetNagCoordinator(nagCoordinator);
 }
Ejemplo n.º 12
0
 public void SetNagCoordinator(NagCoordinator nagCoordinator)
 {
     Search.SetNagCoordinator(nagCoordinator);
 }
Ejemplo n.º 13
0
        public new void Initialize(GoBoard goBoard, Color playerToMove, SearchOptions searchOptions, OnCompletion onCompletion)
        {
            base.Initialize(goBoard, playerToMove, searchOptions, onCompletion);

            // setup distributed search coordinator & initialize workers
            if (NagCoordinator == null)
                NagCoordinator = new NagCoordinator(9999, SearchOptions.PatternDetector.Patterns);	// default port

            NagCoordinator.SetNagCallBack(SetNag);
            NagCoordinator.Initialize(goBoard);

            if (TranspositionTable == null)
                TranspositionTablePrimary = new TranspositionTablePlus(SearchOptions.TranspositionTableSize);
            else
                if (TranspositionTable.Size != SearchOptions.TranspositionTableSize)
                    TranspositionTablePrimary = new TranspositionTablePlus(SearchOptions.TranspositionTableSize);

            if (TranspositionTableEndGame == null)
                TranspositionTableEndGame = new TranspositionTablePlus(1024 * 1024);

            TranspositionTable = TranspositionTablePrimary;
        }
Ejemplo n.º 14
0
 public new void SetNagCoordinator(NagCoordinator nagCoordinator)
 {
     if (nagCoordinator != null)	// hack!
         NagCoordinator = nagCoordinator;
 }