Beispiel #1
0
        public void UnfoldTest2()
        {
            var sheet = new Sheet();

            sheet.Pattern = new List <string>()
            {
                "############################################",
                "#..........................................#",
                "#..........................................#",
                "#..........................................#",
                "#..........................................#",
                "#..........................................#",
                "#..........................................#",
                "#..........................................#",
                "#..........................................#",
                "#..........................................#",
                "############################################"
            }.Select(e => e.ToCharArray().ToList()).ToList();

            for (int i = 0; i < 5; i++)
            {
                sheet.Unfold();
            }

            var pieceCounter = new PieceCounter();

            pieceCounter.Sheet = sheet;
            pieceCounter.CountPieces();
        }
Beispiel #2
0
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());

        string[] inputs = Console.ReadLine().Split(' ');
        int      W      = int.Parse(inputs[0]);
        int      H      = int.Parse(inputs[1]);

        var sheet = new Sheet();

        sheet.Pattern = new List <List <Char> >();

        for (int i = 0; i < H; i++)
        {
            string row = Console.ReadLine();
            sheet.Pattern.Add(row.ToList());
        }

        for (int i = 0; i < N; i++)
        {
            sheet.Unfold();
        }

        var pieceCounter = new PieceCounter();

        pieceCounter.Sheet = sheet;
        pieceCounter.CountPieces();


        // Write an action using Console.WriteLine()
        // To debug: Console.Error.WriteLine("Debug messages...");

        Console.WriteLine(pieceCounter.Counter);
    }
Beispiel #3
0
        public void CountPiecesTest()
        {
            var sheet = new Sheet();

            sheet.Pattern = new List <string>()
            {
                "###",
                "#..",
                "#.#"
            }.Select(e => e.ToCharArray().ToList()).ToList();

            var pieceCounter = new PieceCounter();

            pieceCounter.Sheet = sheet;
            pieceCounter.CountPieces();
            var counter = pieceCounter.Counter;

            Assert.AreEqual(2, counter);
        }