Posts: 23
Threads: 4
Joined: Mar 2025
Reputation:
1
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)
DECLARE SUB GlyphDraw(shape%, ogn%)
DECLARE SUB DrawGridOverlay()
Const PIXEL_SIZE = 10
Const GLYPH_SIZE = 3 * PIXEL_SIZE
Const CELL_SIZE = GLYPH_SIZE + 15
Const GRID_WIDTH = 20
Const GRID_HEIGHT = 13
Const SCREEN_WIDTH = GRID_WIDTH * CELL_SIZE
Const SCREEN_HEIGHT = GRID_HEIGHT * CELL_SIZE
Dim glyphs(259) As Integer
Screen _NewImage(SCREEN_WIDTH, SCREEN_HEIGHT, 32)
' Fill background with blue
Line (0, 0)-(SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), _RGB32(32, 32, 196), BF
' Generate 260 random glyphs (0 to 511)
Randomize Timer
For i = 0 To 259
glyphs(i) = Int(Rnd * 512)
Next
' Draw each glyph at its OGN location
For ogn = 0 To 259
GlyphDraw glyphs(ogn), ogn
Next
' Overlay grid lines
DrawGridOverlay
_PrintString (5, SCREEN_HEIGHT - 20), "Press any key to exit..."
Do: Loop Until InKey$ <> ""
Sub GlyphDraw (shape%, ogn%)
Dim row%, col%, index%, x%, y%
Dim baseX%, baseY%
baseX = (ogn Mod GRID_WIDTH) * CELL_SIZE
baseY = (ogn \ GRID_WIDTH) * CELL_SIZE
For row = 0 To 2
For col = 0 To 2
index = row * 3 + col
x = baseX + col * PIXEL_SIZE
y = baseY + row * PIXEL_SIZE
If (shape And (2 ^ index)) Then
Line (x, y)-(x + PIXEL_SIZE - 1, y + PIXEL_SIZE - 1), _RGB32(76, 255, 0), BF
Else
Line (x, y)-(x + PIXEL_SIZE - 1, y + PIXEL_SIZE - 1), _RGB32(0, 96, 0), BF
End If
Next
Next
End Sub
Sub DrawGridOverlay
Dim gx%, gy%, x%, y%
For gx = 0 To GRID_WIDTH - 1
For gy = 0 To GRID_HEIGHT - 1
x = gx * CELL_SIZE
y = gy * CELL_SIZE
For i = 1 To 2
Line (x + i * PIXEL_SIZE, y)-(x + i * PIXEL_SIZE, y + GLYPH_SIZE - 1), _RGB32(128, 128, 128), BF
Line (x, y + i * PIXEL_SIZE)-(x + GLYPH_SIZE - 1, y + i * PIXEL_SIZE), _RGB32(128, 128, 128), BF
Next
Next
Next
End Sub
Posts: 4,698
Threads: 222
Joined: Apr 2022
Reputation:
322
09-22-2025, 02:23 PM
(This post was last modified: 09-22-2025, 02:29 PM by bplus.)
Fixed?
Code: (Select All) DECLARE SUB GlyphDraw(shape%, ogn%)
DECLARE SUB DrawGridOverlay()
Const PIXEL_SIZE = 10
Const GLYPH_SIZE = 3 * PIXEL_SIZE
Const CELL_SIZE = GLYPH_SIZE + 15
Const GRID_WIDTH = 20
Const GRID_HEIGHT = 13
Const SCREEN_WIDTH = GRID_WIDTH * CELL_SIZE
Const SCREEN_HEIGHT = GRID_HEIGHT * CELL_SIZE
Dim glyphs(259) As Integer
Screen _NewImage(SCREEN_WIDTH, SCREEN_HEIGHT, 32)
' Fill background with blue
Line (0, 0)-(SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), _RGB32(32, 32, 196), BF
' Generate 260 random glyphs (0 to 511)
Randomize Timer
For i = 0 To 259
glyphs(i) = Int(Rnd * 512)
Next
' Draw each glyph at its OGN location
For ogn% = 0 To 259
GlyphDraw glyphs(ogn%), ogn%
Next
' Overlay grid lines
DrawGridOverlay
_PrintString (5, SCREEN_HEIGHT - 20), "Press any key to exit..."
Do: Loop Until InKey$ <> ""
Sub GlyphDraw (shape%, ogn%)
Dim row%, col%, index%, x%, y%
Dim baseX%, baseY%
baseX% = (ogn% Mod GRID_WIDTH) * CELL_SIZE
baseY% = (ogn% \ GRID_WIDTH) * CELL_SIZE
For row% = 0 To 2
For col% = 0 To 2
index = row% * 3 + col
x% = baseX% + col% * PIXEL_SIZE
y% = baseY% + row% * PIXEL_SIZE
If (shape% And (2 ^ index%)) Then
Line (x%, y%)-(x% + PIXEL_SIZE - 1, y% + PIXEL_SIZE - 1), _RGB32(76, 255, 0), BF
Else
Line (x%, y%)-(x% + PIXEL_SIZE - 1, y% + PIXEL_SIZE - 1), _RGB32(0, 96, 0), BF
End If
Next
Next
End Sub
Sub DrawGridOverlay
Dim gx%, gy%, x%, y%
For gx% = 0 To GRID_WIDTH - 1
For gy% = 0 To GRID_HEIGHT - 1
x% = gx% * CELL_SIZE
y% = gy% * CELL_SIZE
For i = 1 To 2
Line (x% + i * PIXEL_SIZE, y)-(x% + i * PIXEL_SIZE, y% + GLYPH_SIZE - 1), _RGB32(128, 128, 128), BF
Line (x%, y% + i * PIXEL_SIZE)-(x% + GLYPH_SIZE - 1, y% + i * PIXEL_SIZE), _RGB32(128, 128, 128), BF
Next
Next
Next
End Sub
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??
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever
Posts: 4,698
Threads: 222
Joined: Apr 2022
Reputation:
322
09-22-2025, 02:32 PM
(This post was last modified: 09-22-2025, 11:27 PM by bplus.)
AH! I missed some more %!!!
Code: (Select All) DECLARE SUB GlyphDraw(shape%, ogn%)
DECLARE SUB DrawGridOverlay()
Const PIXEL_SIZE = 10
Const GLYPH_SIZE = 3 * PIXEL_SIZE
Const CELL_SIZE = GLYPH_SIZE + 15
Const GRID_WIDTH = 20
Const GRID_HEIGHT = 13
Const SCREEN_WIDTH = GRID_WIDTH * CELL_SIZE
Const SCREEN_HEIGHT = GRID_HEIGHT * CELL_SIZE
Dim glyphs(259) As Integer
Screen _NewImage(SCREEN_WIDTH, SCREEN_HEIGHT, 32)
' Fill background with blue
Line (0, 0)-(SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), _RGB32(32, 32, 196), BF
' Generate 260 random glyphs (0 to 511)
Randomize Timer
For i = 0 To 259
glyphs(i) = Int(Rnd * 512)
Next
' Draw each glyph at its OGN location
For ogn% = 0 To 259
GlyphDraw glyphs(ogn%), ogn%
Next
' Overlay grid lines
DrawGridOverlay
_PrintString (5, SCREEN_HEIGHT - 20), "Press any key to exit..."
Do: Loop Until InKey$ <> ""
Sub GlyphDraw (shape%, ogn%)
Dim row%, col%, index%, x%, y%
Dim baseX%, baseY%
baseX% = (ogn% Mod GRID_WIDTH) * CELL_SIZE
baseY% = (ogn% \ GRID_WIDTH) * CELL_SIZE
For row% = 0 To 2
For col% = 0 To 2
index% = row% * 3 + col%
x% = baseX% + col% * PIXEL_SIZE
y% = baseY% + row% * PIXEL_SIZE
If (shape% And (2 ^ index%)) Then
Line (x%, y%)-(x% + PIXEL_SIZE - 1, y% + PIXEL_SIZE - 1), _RGB32(76, 255, 0), BF
Else
Line (x%, y%)-(x% + PIXEL_SIZE - 1, y% + PIXEL_SIZE - 1), _RGB32(0, 96, 0), BF
End If
Next
Next
End Sub
Sub DrawGridOverlay
Dim gx%, gy%, x%, y%
For gx% = 0 To GRID_WIDTH - 1
For gy% = 0 To GRID_HEIGHT - 1
x% = gx% * CELL_SIZE
y% = gy% * CELL_SIZE
For i = 1 To 2
Line (x% + i * PIXEL_SIZE, y)-(x% + i * PIXEL_SIZE, y% + GLYPH_SIZE - 1), _RGB32(128, 128, 128), BF
Line (x%, y% + i * PIXEL_SIZE)-(x% + GLYPH_SIZE - 1, y% + i * PIXEL_SIZE), _RGB32(128, 128, 128), BF
Next
Next
Next
End Sub
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%)
DECLARE SUB DrawGridOverlay()
Const PIXEL_SIZE = 10
Const GLYPH_SIZE = 3 * PIXEL_SIZE
Const CELL_SIZE = GLYPH_SIZE + 15
Const GRID_WIDTH = 20
Const GRID_HEIGHT = 13
Const SCREEN_WIDTH = GRID_WIDTH * CELL_SIZE
Const SCREEN_HEIGHT = GRID_HEIGHT * CELL_SIZE
Dim glyphs(259) As Integer
Screen _NewImage(SCREEN_WIDTH, SCREEN_HEIGHT, 32)
' Fill background with blue
Line (0, 0)-(SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), _RGB32(32, 32, 196), BF
' Generate 260 random glyphs (0 to 511)
Randomize Timer
For i = 0 To 259
glyphs(i) = Int(Rnd * 512)
Next
' Draw each glyph at its OGN location
For ogn% = 0 To 259
GlyphDraw glyphs(ogn%), ogn%
Next
' Overlay grid lines
DrawGridOverlay
_PrintString (5, SCREEN_HEIGHT - 20), "Press any key to exit..."
Do: Loop Until InKey$ <> ""
Sub GlyphDraw (shape%, ogn%)
Dim row%, col%, index%, x%, y%
Dim baseX%, baseY%
baseX% = (ogn% Mod GRID_WIDTH) * CELL_SIZE
baseY% = (ogn% \ GRID_WIDTH) * CELL_SIZE
For row% = 0 To 2
For col% = 0 To 2
index% = row% * 3 + col%
x% = baseX% + col% * PIXEL_SIZE
y% = baseY% + row% * PIXEL_SIZE
If (shape% And (2 ^ index%)) Then
Line (x%, y%)-(x% + PIXEL_SIZE - 1, y% + PIXEL_SIZE - 1), _RGB32(76, 255, 0), BF
Else
Line (x%, y%)-(x% + PIXEL_SIZE - 1, y% + PIXEL_SIZE - 1), _RGB32(0, 96, 0), BF
End If
Next
Next
End Sub
Sub DrawGridOverlay
Dim gx%, gy%, x%, y%
For gx% = 0 To GRID_WIDTH - 1
For gy% = 0 To GRID_HEIGHT - 1
x% = gx% * CELL_SIZE
y% = gy% * CELL_SIZE
For i = 1 To 2
Line (x% + i * PIXEL_SIZE, y%)-(x% + i * PIXEL_SIZE, y% + GLYPH_SIZE - 1), _RGB32(128, 128, 128), BF
Line (x%, y% + i * PIXEL_SIZE)-(x% + GLYPH_SIZE - 1, y% + i * PIXEL_SIZE), _RGB32(128, 128, 128), BF
Next
Next
Next
End Sub
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!
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever
Posts: 4,698
Threads: 222
Joined: Apr 2022
Reputation:
322
09-22-2025, 03:48 PM
(This post was last modified: 09-22-2025, 03:50 PM by bplus.)
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!
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever
Posts: 3,447
Threads: 376
Joined: Apr 2022
Reputation:
345
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?
Posts: 4,698
Threads: 222
Joined: Apr 2022
Reputation:
322
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...
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever
Posts: 3,447
Threads: 376
Joined: Apr 2022
Reputation:
345
09-22-2025, 04:29 PM
(This post was last modified: 09-22-2025, 04:31 PM by SMcNeill.)
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)
Posts: 4,698
Threads: 222
Joined: Apr 2022
Reputation:
322
09-22-2025, 06:20 PM
(This post was last modified: 09-22-2025, 06:23 PM by bplus.)
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
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever
Posts: 3,447
Threads: 376
Joined: Apr 2022
Reputation:
345
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.
Posts: 4,698
Threads: 222
Joined: Apr 2022
Reputation:
322
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?
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever
|