Ejemplo n.º 1
0
 private Stopwatch CallSearch(TableLayout tableLayout, bool exitWhenFound)
 {
     var st = new Stopwatch();
     st.Start();
     tableLayout.Search(exitWhenFound);
     st.Stop();
     return st;
 }
Ejemplo n.º 2
0
        public void TestMethod5X5()
        {
            this.CreateBitmap();

            var t = new PaintedTileSetFactory().Create25();
            var tableLayout = new TableLayout(t, 25, 5);
            var st = this.CallSearch(tableLayout, false);
            var headerEndY = this.DrawPaintedTilesHeader(t, 100, 100, 5);
            this.DrawResultTileSequences(tableLayout, 100, headerEndY + 100, 4, 100, st.Elapsed);

            this.SaveBitmap("test5X5.png");
        }
Ejemplo n.º 3
0
        private void DrawResultTileSequences(TableLayout tableLayout, int startX, int startY, int tableColumnCount, int gap, TimeSpan elapsed)
        {
            Debug.WriteLine("tableLayout.ResultTileSequences.Count: {0}", tableLayout.ResultTileSequences.Count);

            Font font = new Font(FontFamily.GenericSansSerif, 20);
            SolidBrush brush = new SolidBrush(Color.Black);
            this.graphics.DrawString(
                string.Format(
                    "A táblán összesen {0} kártya lehet, {1} oszlopban. A keresés {3:0.000} másodperc alatt {2} db elrendezést talált; \n {4} alkalommal próbált meg letenni egy kártyát, és az {5} alkalommal sikerült.",
                    tableLayout.TileCountOnTable,
                    tableLayout.ColumnCount,
                    tableLayout.ResultTileSequences.Count,
                    elapsed.TotalSeconds,
                    tableLayout.PutTileTryCount,
                    tableLayout.PutTileSuccessCount),
                font,
                brush,
                10,
                startY - 120);

            this.graphics.TranslateTransform(startX, startY);

            for (int i = 0; i < tableLayout.ResultTileSequences.Count; i++)
            {
                var tileSequence = tableLayout.ResultTileSequences[i];

                Debug.WriteLine("i: {0}, tileSequence: {1}", i, tileSequence);
                var size = tableLayout.DrawTileSequence(this.graphics, tileSequence);

                int x = (i + 1) % tableColumnCount;
                int y = (i + 1) / tableColumnCount;

                this.graphics.ResetTransform();
                this.graphics.TranslateTransform(startX + ((size.Width + gap) * x), startY + ((size.Height + gap) * y));
            }
        }