Esempio n. 1
0
        private static string Evaluate(MoveNode root)
        {
            SortedSet <MoveNode> nodes = new SortedSet <MoveNode>(new MoveNodeComparer());

            root.Traverse(nodes);
            return(nodes.FirstOrDefault()?.ToString());
        }
Esempio n. 2
0
        static void OldMain(string[] args)
        {
            // game loop
            while (true)
            {
                long seed  = long.Parse(Console.ReadLine()); // needed to predict the next spawns
                int  score = int.Parse(Console.ReadLine());

                int[] cells = new int[16];
                for (int i = 0; i < 4; i++)
                {
                    string[] inputs = Console.ReadLine().Split(' ');
                    for (int j = 0; j < 4; j++)
                    {
                        cells[i * 4 + j] = int.Parse(inputs[j]);
                    }
                }

                var    board = new Board(seed, score, cells);
                var    root  = new MoveNode(board, 5);
                string moves = Evaluate(root);
                Console.WriteLine(moves);
            }
        }