public bool RetrieveGame(GameRecord gameRecord, int pGameNbr) { gameRecord.Clear(); if (pGameNbr < Count) { return(Sequence[pGameNbr].RetrieveGame(gameRecord)); } return(false); }
public static bool Apply(GameRecord gameRecord, GoBoard goBoard, bool undoable, int moves) { int lMoves = (moves <= 0) ? gameRecord.Count : moves; goBoard.SetBoardSize(gameRecord.BoardSize); // will automatically clear for (int i = 0; i < lMoves; i++) if (!goBoard.PlayStone(gameRecord[i].Move, gameRecord[i].Player, undoable)) return false; return true; }
public bool RetrieveGame(GameRecord gameRecord) { foreach (SGFProperty lSGFProperty in Properties) { if (!lSGFProperty.RetrieveGame(gameRecord)) { return(false); } } return(true); }
// 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); }
public static void UpdateTerritory(GameRecord gameRecord, GoBoard goBoard) { if (goBoard.BoardSize != gameRecord.BoardSize) throw new ApplicationException("BUG"); gameRecord.ClearTerritory(); for (int x = 0; x < goBoard.BoardSize; x++) for (int y = 0; y < goBoard.BoardSize; y++) { SafetyStatus lSafetyStatus = goBoard.GetSafetyStatus((goBoard.Coord.At(x, y))); if (lSafetyStatus.IsAlive || lSafetyStatus.IsTerritory) gameRecord.SetTerritory(lSafetyStatus.Player, goBoard.Coord.At(x, y)); } }
public static bool Apply(GameRecord gameRecord, GoBoard goBoard, bool undoable, int moves) { int lMoves = (moves <= 0) ? gameRecord.Count : moves; goBoard.SetBoardSize(gameRecord.BoardSize); // will automatically clear for (int i = 0; i < lMoves; i++) { if (!goBoard.PlayStone(gameRecord[i].Move, gameRecord[i].Player, undoable)) { return(false); } } return(true); }
public bool RetrieveGame(GameRecord gameRecord) { foreach (SGFNode lSGFNode in Nodes) { if (!lSGFNode.RetrieveGame(gameRecord)) { return(false); } } // do 1st (main) variation only if (Variations.Count >= 1) { return(Variations[0].RetrieveGame(gameRecord)); } return(true); }
public static void GamePlayTest(int tests, bool withUndo, bool withSolver) { GoBoard lGoBoard = new GoBoard(19); GameRecord lGameRecord = new GameRecord(); SGFCollection lSGFCollection = new SGFCollection(); lSGFCollection.LoadSGFFromMemory(SGFGameSamples.GAME_1993_ZHONG_JIALIN_HANE_YASUMASA_1); lSGFCollection.RetrieveGame(lGameRecord, 0); SimpleTimer lSimpleTimer = new SimpleTimer(); for (int i = 0; i < tests; i++) { GameRecordBoardAdapter.Apply(lGameRecord, lGoBoard, true); //lGameRecord.Apply(lGoBoard, true); if (withSolver) { int lSafePoints = lGoBoard.CountSafePoints(Color.Black); lSafePoints += lGoBoard.CountSafePoints(Color.White); } if (withUndo) { while (lGoBoard.CanUndo()) { lGoBoard.Undo(); } } } lSimpleTimer.Stop(); Console.Write("19x19 Game [ "); Console.Write((withUndo ? "+Undo " : "")); Console.Write((withSolver ? "+Solver " : "")); Console.Write("] # " + tests.ToString() + " times. "); Console.Write("Elapsed: " + lSimpleTimer.MilliSecondsElapsed.ToString() + " ms "); Console.WriteLine("Avg.: " + (lSimpleTimer.MilliSecondsElapsed / tests).ToString() + " ms "); return; }
public static void UpdateTerritory(GameRecord gameRecord, GoBoard goBoard) { if (goBoard.BoardSize != gameRecord.BoardSize) { throw new ApplicationException("BUG"); } gameRecord.ClearTerritory(); for (int x = 0; x < goBoard.BoardSize; x++) { for (int y = 0; y < goBoard.BoardSize; y++) { SafetyStatus lSafetyStatus = goBoard.GetSafetyStatus((goBoard.Coord.At(x, y))); if (lSafetyStatus.IsAlive || lSafetyStatus.IsTerritory) { gameRecord.SetTerritory(lSafetyStatus.Player, goBoard.Coord.At(x, y)); } } } }
public GameRecord Clone() { GameRecord lGameRecord = new GameRecord(); lGameRecord.BoardSize = BoardSize; lGameRecord.Date = Date; lGameRecord.BlackPlayerName = BlackPlayerName; lGameRecord.WhitePlayerName = WhitePlayerName; lGameRecord.GameName = GameName; lGameRecord.Result = Result; lGameRecord.Comment = Comment; lGameRecord.GameName = GameName; lGameRecord.Place = Place; lGameRecord.Rules = Rules; lGameRecord.WhiteRank = WhiteRank; lGameRecord.BlackRank = BlackRank; lGameRecord.TimeLimit = TimeLimit; lGameRecord.Komi = Komi; lGameRecord.NextPlayer = NextPlayer; lGameRecord.Identification = Identification; lGameRecord.Territory = new List <int> [2]; lGameRecord.Territory[0] = new List <int>(); lGameRecord.Territory[1] = new List <int>(); foreach (GameMove lGameMove in Moves) { lGameRecord.Moves.Add(lGameMove); } for (int lColor = 0; lColor < 2; lColor++) { foreach (int lMove in Territory[lColor]) { lGameRecord.Territory[lColor].Add(lMove); } } return(lGameRecord); }
public static void GamePlayTest(int tests, bool withUndo, bool withSolver) { GoBoard lGoBoard = new GoBoard(19); GameRecord lGameRecord = new GameRecord(); SGFCollection lSGFCollection = new SGFCollection(); lSGFCollection.LoadSGFFromMemory(SGFGameSamples.GAME_1993_ZHONG_JIALIN_HANE_YASUMASA_1); lSGFCollection.RetrieveGame(lGameRecord, 0); SimpleTimer lSimpleTimer = new SimpleTimer(); for (int i = 0; i < tests; i++) { GameRecordBoardAdapter.Apply(lGameRecord, lGoBoard, true); //lGameRecord.Apply(lGoBoard, true); if (withSolver) { int lSafePoints = lGoBoard.CountSafePoints(Color.Black); lSafePoints += lGoBoard.CountSafePoints(Color.White); } if (withUndo) while (lGoBoard.CanUndo()) lGoBoard.Undo(); } lSimpleTimer.Stop(); Console.Write("19x19 Game [ "); Console.Write((withUndo ? "+Undo " : "")); Console.Write((withSolver ? "+Solver " : "")); Console.Write("] # "+tests.ToString()+" times. "); Console.Write("Elapsed: " + lSimpleTimer.MilliSecondsElapsed.ToString() + " ms "); Console.WriteLine("Avg.: " + (lSimpleTimer.MilliSecondsElapsed / tests).ToString() + " ms "); return; }
// 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); }
public bool RetrieveGame(GameRecord gameRecord) { foreach (SGFNode lSGFNode in Nodes) if (!lSGFNode.RetrieveGame(gameRecord)) return false; // do 1st (main) variation only if (Variations.Count >= 1) return Variations[0].RetrieveGame(gameRecord); return true; }
public bool RetrieveGame(GameRecord gameRecord, int pGameNbr) { gameRecord.Clear(); if (pGameNbr < Count) return Sequence[pGameNbr].RetrieveGame(gameRecord); return false; }
public bool RetrieveGame(GameRecord gameRecord) { return RetrieveGame(gameRecord, 0); }
public static bool Apply(GameRecord gameRecord, GoBoard goBoard) { return Apply(gameRecord, goBoard, false, -1); }
public void AddGame(GameRecord gameRecord) { Games.Add(gameRecord); }
public Result(GameRecord gameRecord, int moveNbr) { GameRecord = gameRecord; MoveNbr = moveNbr; }
public static bool Apply(GameRecord gameRecord, GoBoard goBoard, bool undoable) { return Apply(gameRecord, goBoard, undoable, -1); }
public bool RetrieveGame(GameRecord gameRecord) { foreach (SGFProperty lSGFProperty in Properties) if (!lSGFProperty.RetrieveGame(gameRecord)) return false; return true; }
public bool RetrieveGame(GameRecord gameRecord) { return(RetrieveGame(gameRecord, 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; }
public static bool Apply(GameRecord gameRecord, GoBoard goBoard, bool undoable) { return(Apply(gameRecord, goBoard, undoable, -1)); }
public static bool Apply(GameRecord gameRecord, GoBoard goBoard) { return(Apply(gameRecord, goBoard, false, -1)); }
public GameRecord Clone() { GameRecord lGameRecord = new GameRecord(); lGameRecord.BoardSize = BoardSize; lGameRecord.Date = Date; lGameRecord.BlackPlayerName = BlackPlayerName; lGameRecord.WhitePlayerName = WhitePlayerName; lGameRecord.GameName = GameName; lGameRecord.Result = Result; lGameRecord.Comment = Comment; lGameRecord.GameName = GameName; lGameRecord.Place = Place; lGameRecord.Rules = Rules; lGameRecord.WhiteRank = WhiteRank; lGameRecord.BlackRank = BlackRank; lGameRecord.TimeLimit = TimeLimit; lGameRecord.Komi = Komi; lGameRecord.NextPlayer = NextPlayer; lGameRecord.Identification = Identification; lGameRecord.Territory = new List<int>[2]; lGameRecord.Territory[0] = new List<int>(); lGameRecord.Territory[1] = new List<int>(); foreach (GameMove lGameMove in Moves) lGameRecord.Moves.Add(lGameMove); for (int lColor = 0; lColor < 2; lColor++) foreach (int lMove in Territory[lColor]) lGameRecord.Territory[lColor].Add(lMove); return lGameRecord; }
public bool RetrieveGames(GameRecords gameRecords, bool includeVariations) { GameRecord lGameRecord = new GameRecord(); foreach (SGFNode lSGFNode in Nodes) if (!lSGFNode.RetrieveGame(lGameRecord)) return false; if (Variations.Count == 0) { gameRecords.AddGame(lGameRecord); return true; } if (includeVariations) foreach (SGFSequence lSGFSequence in Variations) if (!lSGFSequence.RetrieveGames(gameRecords, includeVariations, lGameRecord)) return false; return true; }
public bool RetrieveGame(GameRecord gameRecord) { switch (PropertyID) { case "S": { string lMoves = Text; // Note: SmartGo includes \n and \r characters in the list of moves while (lMoves.IndexOf('\n') >= 0) lMoves = lMoves.Remove(lMoves.IndexOf('\n')); while (lMoves.IndexOf('\r') >= 0) lMoves = lMoves.Remove(lMoves.IndexOf('\r')); // Compressed SFG if (lMoves.Length % 2 != 0) return false; for (int i = 0; i < lMoves.Length / 2; i++) { string lText = lMoves.Substring(i * 2, 2); gameRecord.PlayStone(CoordinateSystem.AtFromSGF(lText, gameRecord.BoardSize)); } return true; } case "W": { if (Text.Length == 0) { gameRecord.PlayStone(Color.White, CoordinateSystem.PASS); return true; } if (Text.Length != 2) return false; gameRecord.PlayStone(Color.White, CoordinateSystem.AtFromSGF(Text, gameRecord.BoardSize)); return true; } case "B": { if (Text.Length == 0) { gameRecord.PlayStone(Color.Black, CoordinateSystem.PASS); return true; } if (Text.Length != 2) return false; gameRecord.PlayStone(Color.Black, CoordinateSystem.AtFromSGF(Text, gameRecord.BoardSize)); return true; } case "AW": { if (Text.Length != 2) return false; gameRecord.SetupStone(Color.White, CoordinateSystem.AtFromSGF(Text, gameRecord.BoardSize)); return true; } case "AB": { if (Text.Length != 2) return false; gameRecord.SetupStone(Color.Black, CoordinateSystem.AtFromSGF(Text, gameRecord.BoardSize)); return true; } case "PL": { if (Text.Length == 0) return false; if (!Color.IsValidColor(Text)) return false; gameRecord.NextPlayer = Color.ToColor(Text); return true; } case "AE": { return false; // clear points - not implemented } case "DT": { gameRecord.Date = Text; return true; } case "PB": { gameRecord.BlackPlayerName = Text; return true; } case "PW": { gameRecord.WhitePlayerName = Text; return true; } // case "RS": // { // gameRecord.Result = Text; // return true; // } case "GN": { gameRecord.GameName = Text; return true; } case "ID": { gameRecord.Identification = Text; return true; } case "C": { gameRecord.Comment = Text; return true; } case "RU": { gameRecord.Rules = Text; return true; } case "RE": { gameRecord.Result = Text; return true; } case "PC": { gameRecord.Place = Text; return true; } case "BR": { gameRecord.BlackRank = Text; return true; } case "WR": { gameRecord.WhiteRank = Text; return true; } case "HE": { int lHandicapStones = 0; if (!Int32.TryParse(Text.Trim(), out lHandicapStones)) return false; gameRecord.HandicapStones = lHandicapStones; return true; } case "SZ": { int lBoardSize = 0; if (!Int32.TryParse(Text.Trim(), out lBoardSize)) return false; if ((lBoardSize > 19) && (lBoardSize > 1)) return false; gameRecord.BoardSize = lBoardSize; return true; } case "TW": { if (Text.Length != 2) return false; gameRecord.SetTerritory(Color.White, CoordinateSystem.AtFromSGF(Text, gameRecord.BoardSize)); return true; } case "TB": { if (Text.Length != 2) return false; gameRecord.SetTerritory(Color.Black, CoordinateSystem.AtFromSGF(Text, gameRecord.BoardSize)); return true; } default: return true; } }
public bool RetrieveGame(GameRecord gameRecord) { switch (PropertyID) { case "S": { string lMoves = Text; // Note: SmartGo includes \n and \r characters in the list of moves while (lMoves.IndexOf('\n') >= 0) { lMoves = lMoves.Remove(lMoves.IndexOf('\n')); } while (lMoves.IndexOf('\r') >= 0) { lMoves = lMoves.Remove(lMoves.IndexOf('\r')); } // Compressed SFG if (lMoves.Length % 2 != 0) { return(false); } for (int i = 0; i < lMoves.Length / 2; i++) { string lText = lMoves.Substring(i * 2, 2); gameRecord.PlayStone(CoordinateSystem.AtFromSGF(lText, gameRecord.BoardSize)); } return(true); } case "W": { if (Text.Length == 0) { gameRecord.PlayStone(Color.White, CoordinateSystem.PASS); return(true); } if (Text.Length != 2) { return(false); } gameRecord.PlayStone(Color.White, CoordinateSystem.AtFromSGF(Text, gameRecord.BoardSize)); return(true); } case "B": { if (Text.Length == 0) { gameRecord.PlayStone(Color.Black, CoordinateSystem.PASS); return(true); } if (Text.Length != 2) { return(false); } gameRecord.PlayStone(Color.Black, CoordinateSystem.AtFromSGF(Text, gameRecord.BoardSize)); return(true); } case "AW": { if (Text.Length != 2) { return(false); } gameRecord.SetupStone(Color.White, CoordinateSystem.AtFromSGF(Text, gameRecord.BoardSize)); return(true); } case "AB": { if (Text.Length != 2) { return(false); } gameRecord.SetupStone(Color.Black, CoordinateSystem.AtFromSGF(Text, gameRecord.BoardSize)); return(true); } case "PL": { if (Text.Length == 0) { return(false); } if (!Color.IsValidColor(Text)) { return(false); } gameRecord.NextPlayer = Color.ToColor(Text); return(true); } case "AE": { return(false); // clear points - not implemented } case "DT": { gameRecord.Date = Text; return(true); } case "PB": { gameRecord.BlackPlayerName = Text; return(true); } case "PW": { gameRecord.WhitePlayerName = Text; return(true); } // case "RS": // { // gameRecord.Result = Text; // return true; // } case "GN": { gameRecord.GameName = Text; return(true); } case "ID": { gameRecord.Identification = Text; return(true); } case "C": { gameRecord.Comment = Text; return(true); } case "RU": { gameRecord.Rules = Text; return(true); } case "RE": { gameRecord.Result = Text; return(true); } case "PC": { gameRecord.Place = Text; return(true); } case "BR": { gameRecord.BlackRank = Text; return(true); } case "WR": { gameRecord.WhiteRank = Text; return(true); } case "HE": { int lHandicapStones = 0; if (!Int32.TryParse(Text.Trim(), out lHandicapStones)) { return(false); } gameRecord.HandicapStones = lHandicapStones; return(true); } case "SZ": { int lBoardSize = 0; if (!Int32.TryParse(Text.Trim(), out lBoardSize)) { return(false); } if ((lBoardSize > 19) && (lBoardSize > 1)) { return(false); } gameRecord.BoardSize = lBoardSize; return(true); } case "TW": { if (Text.Length != 2) { return(false); } gameRecord.SetTerritory(Color.White, CoordinateSystem.AtFromSGF(Text, gameRecord.BoardSize)); return(true); } case "TB": { if (Text.Length != 2) { return(false); } gameRecord.SetTerritory(Color.Black, CoordinateSystem.AtFromSGF(Text, gameRecord.BoardSize)); return(true); } default: return(true); } }
// 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; }
public static GTPInternalResponse GTPLoadSGF(GTPGoBoard gtpGoBoard, GTPCommand gtpCommand) { if (gtpCommand.GetParameterCount() < 1) return MissingParameterResponse(); int lMoves = 0; if (gtpCommand.GetParameterCount() >= 2) if (!gtpCommand.GetParameter(1, ref lMoves)) return InvalidParameterResponse(); if (lMoves < 0) return InvalidParameterResponse(); string lFullPath = (!string.IsNullOrEmpty(gtpGoBoard.Directory)) ? gtpGoBoard.Directory + Path.DirectorySeparatorChar + gtpCommand.GetParameter(0) : gtpCommand.GetParameter(0); SGFCollection lSGFCollection = new SGFCollection(lFullPath); if (lSGFCollection.IsError()) return new GTPInternalResponse(false, "unable to load file"); GameRecord lGameRecord = new GameRecord(); if (!lSGFCollection.RetrieveGame(lGameRecord)) return new GTPInternalResponse(false, "unable to load file"); if (!GameRecordBoardAdapter.Apply(lGameRecord, gtpGoBoard.Board, true)) // if (!lGameRecord.Apply(gtpGoBoard.Board, true, lMoves)) return new GTPInternalResponse(false, "unable to load file"); return new GTPInternalResponse(true, "sgf loaded"); }