static void ChxMonteCarloTrain()
        {
            using (StreamWriter fs = new StreamWriter(Path.Combine(@"\\GMRDC1\Folder Redirection\Ryan.Alameddine\Documents\Visual Studio 2017\Projects\NeuralNet\MiniMaxTree\MiniMaxTree\bin\Debug\netcoreapp2.1", "CHX.txt"), true))
            {
                Random rand = new Random();
                for (int i = 0; i < 10000; i++)
                {
                    CheckersGS gs = new CheckersGS();
                    gs.Xer = rand.Next(0, 2) == 1;
                    int xCount = rand.Next(1, 13);
                    int oCount = rand.Next(1, 13);
                    for (int x = 0; x < xCount; x++)
                    {
                        int f = rand.Next(0, 32) * 2;
                        if (f % 16 < 8)
                        {
                            f++;
                        }
                        if (gs.marks[f] != '\0')
                        {
                            x--;
                            continue;
                        }
                        else
                        {
                            if (rand.Next(0, 10) == 0)
                            {
                                gs.marks[f] = 'X';
                            }
                            else
                            {
                                gs.marks[f] = 'x';
                            }
                        }
                    }

                    for (int o = 0; o < oCount; o++)
                    {
                        int f = rand.Next(0, 32) * 2;
                        if (f % 16 < 8)
                        {
                            f++;
                        }
                        if (gs.marks[f] != '\0')
                        {
                            o--;
                            continue;
                        }
                        else
                        {
                            if (rand.Next(0, 10) == 0)
                            {
                                gs.marks[f] = 'O';
                            }
                            else
                            {
                                gs.marks[f] = 'o';
                            }
                        }
                    }
                    var node = new MiniMaxNode <CheckersGS>(gs);
                    Console.SetCursorPosition(0, 0);
                    gs.ConsoleWrite();
                    Console.WriteLine(i);
                    CheckersGM.MonteCarlo(node, gs.Xer);
                    string ln = node.Value + ":" + gs.ToCompact();
                    fs.WriteLine(ln);
                    fs.Flush();
                }
            }
            //File.AppendAllLines("", lines);
        }
        static void Chx()
        {
            CheckersGM manager = new CheckersGM();
            MiniMaxTree <CheckersGS> C4Tree = new MiniMaxTree <CheckersGS>(manager, false, new CheckersGS(true));

            string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "trained.json");

            manager.monteNet = JsonConvert.DeserializeObject <NeuralNetwork.NeuralNetwork>(File.ReadAllText(path));

            while (!C4Tree.Root.gameState.gameFinished)
            {
                Console.SetCursorPosition(0, 0);
                C4Tree.Root.gameState.ConsoleWrite();

                ReadOnlySpan <char> charStore = stackalloc char[] { Console.ReadKey().KeyChar };
                int input = int.Parse(charStore);
                int x     = input - 1;

                charStore = stackalloc char[] { Console.ReadKey().KeyChar };
                input     = int.Parse(charStore);
                int y = input - 1;

                charStore = stackalloc char[] { Console.ReadKey().KeyChar };
                input     = int.Parse(charStore);

                CheckersGS currentGS = C4Tree.Root.gameState;

                (int x, int y)d = (0, 0);
                if (input == 9)
                {
                    d = (1, 1);
                }
                else if (input == 7)
                {
                    d = (-1, 1);
                }
                else if (input == 1)
                {
                    d = (-1, -1);
                }
                else if (input == 3)
                {
                    d = (1, -1);
                }

                if (currentGS.marks[x + d.x, y + d.y] == '\0')
                {
                    currentGS.marks[x + d.x, y + d.y] = currentGS.marks[x, y];
                    currentGS.marks[x, y]             = '\0';
                }
                else
                {
                    currentGS.marks[x + d.x, y + d.y]             = '\0';
                    currentGS.marks[x + d.x + d.x, y + d.y + d.y] = currentGS.marks[x, y];
                    currentGS.marks[x, y] = '\0';
                }

                List <MiniMaxNode <CheckersGS> > leafList = new List <MiniMaxNode <CheckersGS> >();

                manager.GenerateTree(C4Tree.Root, true, 6);
                Console.Clear();
                manager.AlphaBetaMonteCarlo(C4Tree.Root, true);
                manager.CalculateTree(C4Tree.Root, true);

                if (C4Tree.Root.children.Length != 0)
                {
                    int i = 0;
                    for (; C4Tree.Root.children[i].Value != C4Tree.Root.Value; i++)
                    {
                        ;
                    }

                    C4Tree.Root        = C4Tree.Root.children[i];
                    C4Tree.Root.pruned = false;
                }
            }
            Console.Clear();
            C4Tree.Root.gameState.ConsoleWrite();
        }
    }