Ejemplo n.º 1
0
 static void Main(string[] args)
 {
     try
     {
         Game3      game = new Game3(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0, 15);
         ConsoleuUI c    = new ConsoleuUI(game);
         //Game3 CSVGame = Reader.FromCSV("input.csv");
         //Printer.PrintBoard(CSVGame);
         //Printer.PrintBoard(game);
         c.Play();
     }
     catch (Exception e1)
     {
         Console.WriteLine(e1.Message);
     }
 }
Ejemplo n.º 2
0
        public static void PrintBoard(Game3 game)
        {
            int a = 0;
            int b = 0;

            for (a = 0; a < game.sideLength; a++)
            {
                for (b = 0; b < game.sideLength; b++)
                {
                    Console.Write(game[a, b] + "\t");
                }
                Console.WriteLine();
                Console.WriteLine();
            }

            Console.WriteLine();
            Console.WriteLine();
        }
Ejemplo n.º 3
0
        public static Game3 FromCSV(string filename)
        {
            Game3 game = new Game3();

            string[]   field    = File.ReadAllLines(filename);
            List <int> knuckles = new List <int>();

            for (int i = 0; i < field.Length; i++)
            {
                var numbers = field[i].Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                if (numbers.Length != field.Length)
                {
                    throw new Exception("Serrated edge");
                }

                for (int j = 0; j < numbers.Count(); j++)
                {
                    knuckles.Add(Convert.ToInt32(numbers[j]));
                }
            }
            int[] final = knuckles.ToArray();
            game = new Game3(final);
            return(game);
        }