public void FlipH() { Arr2dManipulation.FlipH(ref pattern); }
public static void Task2() { Console.WriteLine("AOC2020_Day20_2"); TileList list = new TileList(); list.Load(); // proste vemu prvni roh var TopLeft = GetCorners(list)[0]; // zrotuji jej tak aby mel vlevo a vpravo volno... while ( list.FindMatchingTileBySide(TopLeft, TopLeft.t) != null || list.FindMatchingTileBySide(TopLeft, TopLeft.l) != null ) { TopLeft.Rotate(); } // mapa spravne zorientocanych tilu Tile [,] tmap = new Tile[12, 12]; tmap[0, 0] = TopLeft; int cnt = Convert.ToInt32(Math.Sqrt(list.Count)); // vyplnim mapu for (int j = 0; j < cnt; j++) { for (int i = 1; i < cnt; i++) { // najdu tile pod nim a zrotuji tak aby byl side na vrsku... Tile top = tmap[j, i - 1]; tmap[j, i] = list.FindMatchingTileBySide(top, top.b); tmap[j, i].MakeTopside(top.b); // najdu tile mapravo a zrotuji tak aby byl side na vnalevo Tile left = tmap[i - 1, j]; tmap[i, j] = list.FindMatchingTileBySide(left, left.r); tmap[i, j].MakeLeftside(left.r); } } // jedna mapa var map = new char[cnt * 8, cnt * 8]; for (int ty = 0; ty < cnt; ty++) { for (int tx = 0; tx < cnt; tx++) { // najdu tile pod nim a zrotuji tak aby byl side na vrsku... Tile t = tmap[tx, ty]; for (int y = 1; y < 9; y++) { for (int x = 1; x < 9; x++) { map[tx * 8 + x - 1, ty *8 + y - 1] = t.map[x, y]; } } } } var monster = new Monster(); monster.Load(); for (int i = 0; i < 8; i++) { monster.TestMonsters(ref map); if ((i + 1) % 4 == 0) { Arr2dManipulation.FlipH(ref map); } else { Arr2dManipulation.Rotate(ref map); } } Console.WriteLine("# : {0}", Arr2dManipulation.GetHaspCount(map)); }
public void FlipH() { Arr2dManipulation.FlipH(ref map); }