Exemple #1
0
        public void CreateKnowledge()
        {
            //int endGameDepth = Math.Min((Constants.StoneCount - 4) / 2, 20);

            int initialCount = 6;
            int leftEmpthCount = initialCount;

            while (leftEmpthCount <= Constants.StoneCount - 4) {

                string knowFile = string.Format("{0}-{1}-{2:yyyy-MM-dd}.know",
                                            Constants.Line,
                                            leftEmpthCount,
                                            DateTime.Now);
                IEngine engine;
                if(leftEmpthCount > initialCount+1  ) {
                     engine = new NeuralEngine();
                }
                else {
                    engine = new EndGameEngine();
                }

                var know = new Knowledge(1000000, leftEmpthCount, leftEmpthCount > initialCount+1 ? 2 : 12);
                know.Engine = engine;
                know.Generate(knowFile);

                var networkFile = Learn(knowFile);

                leftEmpthCount++;
            }
        }
Exemple #2
0
        static void NeuralEngine_Test(string boardText, int bestMove)
        {
            IEngine engine = new EndGameEngine();
            var board = new Board(boardText);
            var color = board.EmptyCount % 2 == 1 ? StoneType.White : StoneType.Black;

            var searchResult = engine.Search(board.Copy(), color, 16);
            Console.WriteLine("EndGameEngine Best Move Act:{0},Exp:{1} | Score Act:{2}, {3}, Nodes:{4}, Times:{5}",
                searchResult.Move, bestMove, searchResult.Score / Constants.HighestScore, searchResult.Message,
                searchResult.Nodes, searchResult.TimeSpan);

            engine = new NeuralEngine();//"4-6-2012-04-24.net"
            searchResult = engine.Search(board.Copy(), color, 4);// (Constants.StoneCount - 4) / 2
            Console.WriteLine("NeuralEngine Best Move Act:{0},Exp:{1} | Score Act:{2}, {3}, Nodes:{4}, Times:{5}",
                searchResult.Move, bestMove, searchResult.Score, searchResult.Message,
                searchResult.Nodes, searchResult.TimeSpan);
        }