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; }
// 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); }
// 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; }