public static void GamePlayTestSolver(int tests, 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();

            GameRecordBoardAdapter.Apply(lGameRecord, lGoBoard, true);
            //lGameRecord.Apply(lGoBoard, true);

            for (int i = 0; i < tests; i++)
            {
                if (withSolver)
                {
                    lGoBoard.SafetyStatusMap = null;
                    int lSafePoints = lGoBoard.CountSafePoints(Color.Black);
                    lSafePoints += lGoBoard.CountSafePoints(Color.White);
                }
            }

            lSimpleTimer.Stop();

            Console.Write("19x19 Game - Solver [ ");
            Console.Write("] # " + tests.ToString() + " times. ");
            Console.Write("Elapsed: " + lSimpleTimer.MilliSecondsElapsed.ToString() + " ms ");
            Console.WriteLine("Avg.: " + (lSimpleTimer.MilliSecondsElapsed / tests).ToString() + " ms ");

            return;
        }
示例#2
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);
        }
示例#3
0
        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;
        }
示例#4
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);
        }
示例#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;
        }
示例#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;
        }
示例#7
0
        public static int IGS31()
        {
            GameRecords lGameRecords = new GameRecords();
            SGFCollection lSGFCollection = new SGFCollection(@"Regression\IGS_31\Source\IGS_31_counted.sgf");
            lGameRecords.Load(lSGFCollection, true);

            Dictionary<SafetyStatus, int> lSafetyUsage = new Dictionary<SafetyStatus, int>();

            foreach (GameRecord lGameRecord in lGameRecords.Games)
            {
                GoBoard lGoBoard = new GoBoard(19);
                GameRecordBoardAdapter.Apply(lGameRecord, lGoBoard);
                //lGameRecord.Apply(lGoBoard);

                foreach (GoCell lCell in lGoBoard.Cells)
                {
                    SafetyStatus lSafetyStatus = lGoBoard.GetSafetyStatus(lCell.Index);

                    if (lSafetyUsage.ContainsKey(lSafetyStatus))
                        lSafetyUsage[lSafetyStatus] += 1;
                    else
                        lSafetyUsage[lSafetyStatus] = 1;
                }

                Console.Write(".");
            }
            Console.WriteLine();
            foreach (SafetyStatus lSafetyStatus in lSafetyUsage.Keys)
            {
                Console.Write(lSafetyStatus.ToInteger());
                Console.Write(" | {0}", lSafetyStatus);
                Console.WriteLine(" | " + lSafetyUsage[lSafetyStatus].ToString());
            }

            MemFile lMemFile = new MemFile();
            lMemFile.WriteLine(lGameRecords.ToString());
            lMemFile.SaveFile(@"Regression\IGS_31\IGS_31-combined.sgf");

            SafetySolverType lSafetySolverType = SafetySolverType.Muller97;

            for (int i = 0; i < lGameRecords.Games.Count; i++)
            {
                GoBoard lGoBoard = new GoBoard(19);
                GameRecordBoardAdapter.Apply(lGameRecords[i], lGoBoard);
                //lGameRecords[i].Apply(lGoBoard);
                GameRecordBoardAdapter.UpdateTerritory(lGameRecords[i], lGoBoard);
                //lGameRecords[i].UpdateTerritory(lGoBoard);
                //Console.WriteLine(lGoBoard.ToString());
                Console.Write(i.ToString());
                Console.Write(" : ");
                Console.Write(lGoBoard.CountSafePoints(Color.Both, lSafetySolverType).ToString());
                Console.Write(" ");
                Console.Write(lGoBoard.CountSafePoints(Color.Black, lSafetySolverType).ToString());
                Console.Write(" ");
                Console.WriteLine(lGoBoard.CountSafePoints(Color.White, lSafetySolverType).ToString());
            }

            for (int i = 0; i < lGameRecords.Games.Count; i++)
            {

                MemFile lMemFile2 = new MemFile();
                lMemFile2.WriteLine(lGameRecords[i].ToString());
                lMemFile2.SaveFile(@"Regression\IGS_31\IGS_31-" + ((i + 1).ToString()) + ".sgf");
            }

            return 0;
        }
示例#8
0
        public override string ToString()
        {
            SGFCollection lSGFCollection = new SGFCollection();
            SGFSequence lSGFSequence = new SGFSequence();
            SGFNode lSGFNode = new SGFNode();

            CoordinateSystem lCoord = CoordinateSystem.GetCoordinateSystem(BoardSize);

            lSGFNode.AddProperty(new SGFProperty("GM", "1"));
            lSGFNode.AddProperty(new SGFProperty("FF", "4"));
            lSGFNode.AddProperty(new SGFProperty("CA", "UTF-8"));
            lSGFNode.AddProperty(new SGFProperty("SZ", BoardSize));
            lSGFNode.AddProperty(new SGFProperty("KM", Convert.ToString(Komi)));

            lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("GN", GameName));
            lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("ID", Identification));
            lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("DT", Date));
            lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("PB", BlackPlayerName));
            lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("PW", WhitePlayerName));
            //			lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("RS", Result));
            lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("C", Comment));
            lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("RU", Rules));
            lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("PC", Place));
            lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("WR", WhiteRank));
            lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("BR", BlackRank));
            lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("RE", Result));

            if (TimeLimit != 0)
                lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("TM", TimeLimit));

            if (HandicapStones > 0)
                lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("HE", HandicapStones));

            lSGFSequence.AddNode(lSGFNode);

            foreach (GameMove lGameMove in Moves)
            {
                lSGFNode = new SGFNode();

                lSGFNode.AddProperty(new SGFProperty(
                    (lGameMove.SetupMove ? "A" : "") + (lGameMove.Player.IsBlack ? "B" : "W")
                    , lCoord.ToSGFString(lGameMove.Move)));

                lSGFSequence.AddNode(lSGFNode);
            }

            if ((Territory[0].Count != 0) || (Territory[1].Count != 0))
            {
                lSGFNode = new SGFNode();

                for (int lTerritoryIndex = 0; lTerritoryIndex < 2; lTerritoryIndex++)
                {
                    if (Territory[lTerritoryIndex].Count != 0)
                    {

                        foreach (int lIndex in Territory[lTerritoryIndex])
                        {
                            lSGFNode.AddProperty(new SGFProperty(
                                "T" + (lTerritoryIndex == 0 ? "B" : "W"), lCoord.ToSGFString(lIndex)));
                        }
                    }

                }
                lSGFSequence.AddNode(lSGFNode);
            }

            lSGFCollection.AddSequence(lSGFSequence);

            return lSGFCollection.ToString();
        }
示例#9
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");
        }
示例#10
0
        public override string ToString()
        {
            SGFCollection lSGFCollection = new SGFCollection();
            SGFSequence   lSGFSequence   = new SGFSequence();
            SGFNode       lSGFNode       = new SGFNode();

            CoordinateSystem lCoord = CoordinateSystem.GetCoordinateSystem(BoardSize);

            lSGFNode.AddProperty(new SGFProperty("GM", "1"));
            lSGFNode.AddProperty(new SGFProperty("FF", "4"));
            lSGFNode.AddProperty(new SGFProperty("CA", "UTF-8"));
            lSGFNode.AddProperty(new SGFProperty("SZ", BoardSize));
            lSGFNode.AddProperty(new SGFProperty("KM", Convert.ToString(Komi)));

            lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("GN", GameName));
            lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("ID", Identification));
            lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("DT", Date));
            lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("PB", BlackPlayerName));
            lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("PW", WhitePlayerName));
            //			lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("RS", Result));
            lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("C", Comment));
            lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("RU", Rules));
            lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("PC", Place));
            lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("WR", WhiteRank));
            lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("BR", BlackRank));
            lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("RE", Result));

            if (TimeLimit != 0)
            {
                lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("TM", TimeLimit));
            }

            if (HandicapStones > 0)
            {
                lSGFNode.AddPropertyIfNotEmpty(new SGFProperty("HE", HandicapStones));
            }

            lSGFSequence.AddNode(lSGFNode);

            foreach (GameMove lGameMove in Moves)
            {
                lSGFNode = new SGFNode();

                lSGFNode.AddProperty(new SGFProperty(
                                         (lGameMove.SetupMove ? "A" : "") + (lGameMove.Player.IsBlack ? "B" : "W")
                                         , lCoord.ToSGFString(lGameMove.Move)));

                lSGFSequence.AddNode(lSGFNode);
            }

            if ((Territory[0].Count != 0) || (Territory[1].Count != 0))
            {
                lSGFNode = new SGFNode();

                for (int lTerritoryIndex = 0; lTerritoryIndex < 2; lTerritoryIndex++)
                {
                    if (Territory[lTerritoryIndex].Count != 0)
                    {
                        foreach (int lIndex in Territory[lTerritoryIndex])
                        {
                            lSGFNode.AddProperty(new SGFProperty(
                                                     "T" + (lTerritoryIndex == 0 ? "B" : "W"), lCoord.ToSGFString(lIndex)));
                        }
                    }
                }
                lSGFSequence.AddNode(lSGFNode);
            }

            lSGFCollection.AddSequence(lSGFSequence);

            return(lSGFCollection.ToString());
        }
示例#11
0
 public bool Load(SGFCollection sgfCollection, bool includeVariations)
 {
     return(sgfCollection.RetrieveGames(this, includeVariations));
 }
示例#12
0
        public static int IGS31()
        {
            GameRecords   lGameRecords   = new GameRecords();
            SGFCollection lSGFCollection = new SGFCollection(@"Regression\IGS_31\Source\IGS_31_counted.sgf");

            lGameRecords.Load(lSGFCollection, true);

            Dictionary <SafetyStatus, int> lSafetyUsage = new Dictionary <SafetyStatus, int>();

            foreach (GameRecord lGameRecord in lGameRecords.Games)
            {
                GoBoard lGoBoard = new GoBoard(19);
                GameRecordBoardAdapter.Apply(lGameRecord, lGoBoard);
                //lGameRecord.Apply(lGoBoard);

                foreach (GoCell lCell in lGoBoard.Cells)
                {
                    SafetyStatus lSafetyStatus = lGoBoard.GetSafetyStatus(lCell.Index);

                    if (lSafetyUsage.ContainsKey(lSafetyStatus))
                    {
                        lSafetyUsage[lSafetyStatus] += 1;
                    }
                    else
                    {
                        lSafetyUsage[lSafetyStatus] = 1;
                    }
                }

                Console.Write(".");
            }
            Console.WriteLine();
            foreach (SafetyStatus lSafetyStatus in lSafetyUsage.Keys)
            {
                Console.Write(lSafetyStatus.ToInteger());
                Console.Write(" | {0}", lSafetyStatus);
                Console.WriteLine(" | " + lSafetyUsage[lSafetyStatus].ToString());
            }

            MemFile lMemFile = new MemFile();

            lMemFile.WriteLine(lGameRecords.ToString());
            lMemFile.SaveFile(@"Regression\IGS_31\IGS_31-combined.sgf");

            SafetySolverType lSafetySolverType = SafetySolverType.Muller97;

            for (int i = 0; i < lGameRecords.Games.Count; i++)
            {
                GoBoard lGoBoard = new GoBoard(19);
                GameRecordBoardAdapter.Apply(lGameRecords[i], lGoBoard);
                //lGameRecords[i].Apply(lGoBoard);
                GameRecordBoardAdapter.UpdateTerritory(lGameRecords[i], lGoBoard);
                //lGameRecords[i].UpdateTerritory(lGoBoard);
                //Console.WriteLine(lGoBoard.ToString());
                Console.Write(i.ToString());
                Console.Write(" : ");
                Console.Write(lGoBoard.CountSafePoints(Color.Both, lSafetySolverType).ToString());
                Console.Write(" ");
                Console.Write(lGoBoard.CountSafePoints(Color.Black, lSafetySolverType).ToString());
                Console.Write(" ");
                Console.WriteLine(lGoBoard.CountSafePoints(Color.White, lSafetySolverType).ToString());
            }

            for (int i = 0; i < lGameRecords.Games.Count; i++)
            {
                MemFile lMemFile2 = new MemFile();
                lMemFile2.WriteLine(lGameRecords[i].ToString());
                lMemFile2.SaveFile(@"Regression\IGS_31\IGS_31-" + ((i + 1).ToString()) + ".sgf");
            }

            return(0);
        }
示例#13
0
 public bool Load(SGFCollection sgfCollection, bool includeVariations)
 {
     return sgfCollection.RetrieveGames(this, includeVariations);
 }