Example #1
0
        private static void RunOptionsAndReturnExitCode(Options opts)
        {
            if (opts.DoLog)
            {
                ConfigureLog4Net();
            }

            try
            {
                using (FileStream fs = new FileStream(opts.JsonPath, FileMode.Open))
                {
                    using (StreamReader sr = new StreamReader(fs))
                    {
                        string json = sr.ReadToEnd();
                        Puzzle = JsonConvert.DeserializeObject <PicrossPuzzle>(json);
                        Console.WriteLine($"Loaded puzzle from {fs.Name}");
                    }
                }
            }
            catch (Exception)
            {
                Console.WriteLine("Error while opening json");
            }

            Board = new PicrossBoard(Puzzle);
            Console.WriteLine("Board loaded, next is solving...");
            Board.Solve(verboseLevel: opts.Verbose);
            Console.WriteLine("Solving complete, result:");
            Console.Write(Board.Print());

            if (!opts.NoWait)
            {
                PressEnterToContinue();
            }
        }
Example #2
0
        public PicrossGame()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            picrossBoard = new PicrossBoard();
        }
Example #3
0
        public void SolveEmpty()
        {
            //Testing that this doesn't throw
            var board = PicrossBoard.GetEmpty();

            board.Solve();
        }
Example #4
0
 public void LoadFromJson_Solve(string puzzlePath)
 {
     using (FileStream fs = new FileStream(puzzlePath, FileMode.Open))
     {
         using (StreamReader sr = new StreamReader(fs))
         {
             string        json   = sr.ReadToEnd();
             PicrossPuzzle puzzle = JsonConvert.DeserializeObject <PicrossPuzzle>(json);
             PicrossBoard  board  = new PicrossBoard(puzzle);
             board.Solve();
             Assert.True(board.IsSolved);
         }
     }
 }
Example #5
0
 public void ConstructEmpty()
 {
     //Testing that this doesn't throw
     var board = PicrossBoard.GetEmpty();
 }