![]() |
|
program to draw a grid of grids and out put all unique 3X3 patterns - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Works in Progress (https://qb64phoenix.com/forum/forumdisplay.php?fid=9) +---- Thread: program to draw a grid of grids and out put all unique 3X3 patterns (/showthread.php?tid=3957) |
program to draw a grid of grids and out put all unique 3X3 patterns - Dragoncat - 09-22-2025 here Is a program I was writing with the help of Ai It works but not as expected it is supposed to create all 3x 3 glyphs that are unique )shifted shapes don't count as unique it is supposed to place each unique 3X3 pattern into each grid and it only fills the first grid what is wrong? the rules it has to follow is simple every shape or glyph must have every pixel in it connected to all the others either horizontally or vertically or diagonally I allready know there are 260 in this set and there are 92 that are not including rotations of ones but including mirror images ones where the mirror does not match the origional shape no matter how much it is rotated or shifted there are 19 such chiraal shapes leaving 73 shapes if you count these mirror images as being the same... how can I fix this program so it properly displays all 260 glyphs and in the right locations even, and possibly adding in a value for each that gives it a unique value based on an order binary representation of the glyph? (reading up from 2^0 being the bottom left and increasing left to right and bottom to top in powers of 2)?? and saya printing this value in a 3 by 4 graphical font that draws the numbers into the wasste space under each glyph? that can be added later I just need to figure out how to get the glyphs to displaay right The ai keeps spitting out programs that are identically equivelent to this one. like it is stuck in an unending loop, please help Code: (Select All)
RE: program to draw a grid of grids and out put all unique 3X3 patterns - bplus - 09-22-2025 Fixed? Code: (Select All) DECLARE SUB GlyphDraw(shape%, ogn%)If DIM variable with % then use it throughout with % attached, otherwise another variable may be assumed as defualt single type and treated separately. You did get away with it in DrawGridOverlay, maybe it was passing the arguments with % and not using those variables with % attached that caught you in GlyphDraw? But arent all the Tic Tac Toe boards supposed to have different combos of blocks? Oh I just noticed vertical lines extending all the way top to bottom?? RE: program to draw a grid of grids and out put all unique 3X3 patterns - bplus - 09-22-2025 AH! I missed some more %!!! Code: (Select All) DECLARE SUB GlyphDraw(shape%, ogn%)That's it what I was expecting! No damn it still have the lines from top to bottom! Here it is! Code: (Select All) DECLARE SUB GlyphDraw(shape%, ogn%)Edit: I fixed the lines but forgot to save the change for 1 y missing a %, fixed now so code should match the snapshot posted here: Cool! RE: program to draw a grid of grids and out put all unique 3X3 patterns - bplus - 09-22-2025 Obviously this program is not drawing all 512 shapes because you are picking randomly from 512, let alone determining if all the shapes are unique. Lets do that next! All 512 shapes piece of cake except for fitting them all on screen, possible. Determining uniqueness now there is something very interesting! Consider 1 dot (or 8 of 9 dots?) 1 for a dot for each corner, 4 rotations 1 dor a dot for each side, 4 rotations 1 for a dot in center, just 1 Now 2 dots things get complicated fast! Maybe Steve @SMcNeill has a practical way do handle this? They (and he) says he is amazing! RE: program to draw a grid of grids and out put all unique 3X3 patterns - SMcNeill - 09-22-2025 Isn't this just like the word creation/permutations programs done, but in a graphical manner? 123456789 <- This is our string (or 3 x3 grid of 9 elements in this case). 1 <- top left corner filled 12 <-- top left corner then top middle filled. 123 <-- top row filled completely. and so on to 123456789 <-- entire grid filled. Then it's: 2 <-- top middle 23 <-- top middle and right and so on... until every match is made. Or am I missing something here? RE: program to draw a grid of grids and out put all unique 3X3 patterns - bplus - 09-22-2025 3x3 graphics rotations is probably different than permutations and combos of numbers or strings. I will be convince someone's got it when they come up with code that gets that 260 number DragonCat mentioned which might be correct. I dont know, this sounds like a Rosetta Code challange, I better check over there... RE: program to draw a grid of grids and out put all unique 3X3 patterns - SMcNeill - 09-22-2025 Rotations? Like a tic-tac-toe game? It's the same, but you have to account for various starting points. outer-edge (one outer edge would be the same as any other) outer-middle (one outer middle would the same as any other) center. then fill from there. 4 outer-edge, 4 outer-middle, center... Isn't this basically a permutation like doing with a word: "EEEEMMMMC" -- remove duplicates. (Edge, Middle, Center) RE: program to draw a grid of grids and out put all unique 3X3 patterns - bplus - 09-22-2025 Like I said if you think you have it, write some code that comes up with the assumed correct number of 260. Or equally prove it wont be 260 which might be easier, just show 260 wont work. BTW all the solutions to TTT might be ONE! all up and down = all left and right = diagonal, straight lines of 3 blocks RE: program to draw a grid of grids and out put all unique 3X3 patterns - SMcNeill - 09-22-2025 My thought of 4 outer, 4 middle, 1 center was a little simplex at deeper glance. To start with, you have the above. X00 000 000 No matter which corner you place that X, it's going to be the same once you rotate 90/180/270 degrees. At this point, however, things get one step more complicated. You now have to take into account adjacent or opposite: X0Y 000 Y00 Like above, both those Y's would result in the same pattern rotated. You can all them adjacent-edges. X00 000 00Y The opposite edge is going to be different than the adjacent-edges. My idea of 4 outer, 4 middle, center doesn't take this distinction into account. What'd I generate would be: n! /(n1! * n2! * n3!) n! would be 9! (for total number of permutations) n1! would be 4! (for the four outer squares) n2! would be 4! (for the four middle squares) n3! would be 1! (for the center square) Do the math and I'd come up with 630 results, but that's not accounting the adjacent-opposite rotational results I explained above. I'd have duplicate results in there. But 630 is now a small enough number that we could create an array with those results and then just compare them on a rotational matrix and remove the duplicates. I'm not certain that the number would be 260 without doing it, and I'm kind of busy playing around with other things at the moment, but I think that's the method I'd use to code it out and come up with the final results. Permutate "OOOOMMMMC" and get the 630 results. Then just compare those against each other on a rotational matrix, removing duplicates as you go. This way: X0X 000 000 and: X00 000 X00 would both be generated in the 630 array, but then you'd just rotate and remove one from it to get your unique solutions. RE: program to draw a grid of grids and out put all unique 3X3 patterns - bplus - 09-22-2025 2^9 = 512 is number of variations because there are 2 choices for each of 9 positions On or Off but deciding rotations or symmetries? One fill of each of 9 positions might be considered the same? Whose game rules are we playing by? |