Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
BAM: _LETCHR$ and _GETCHR$
#11
(05-09-2023, 07:22 PM)bplus Wrote: Oh yours looks like tiling on a slant, with pixel offsets?, as opposed to filling "character cells" straight up and down or across fills.

I will try that...

Do you suppose an 8x8 cell is ideal for neat looking designs? Is you Random fill 50/50?

That should be an easy question to answer, but I'm struggling.

Maybe we can get somewhere by analysing the code in chunks.

Code: (Select All)
CreateGraphicsChars:
        c$ = "" : d$ = ""
        FOR i = 1 TO 64
            p$ = defPixel$()
            c$ = c$ + p$
            d$ = p$ + d$
        NEXT i
        _LETCHR$(0, c$) : _LETCHR$(1, d$)
    RETURN

Every image is created with two custom 8x8 characters.

The first character, each pixel is randomly set on or off.  The second character is the equivalent of result of flipping the first character on the vertical axis and again on the horizontal axis.

The _LETCHR$ function will assign a new character to the identified ASCII code, and based on the specification in the 64-character string parameter.  (One character per pixel, "X" meaning pixel on, "." meaning pixel off.

So the subroutine above creates two strings, first one to generate a new character for ASCII code 0, the second one (diagonal flippy of the first) assigned to ASCII code 1.

50-50 chance of a pixel being turned on:

Code: (Select All)
FUNCTION defPixel$()
  defPixel$ = "."
  IF INT(RND*2) = 1 THEN defPixel$ = "X"
END FUNCTION


Let's make sure all of that makes sense, then we can look at the next thing.
Reply
#12
(05-09-2023, 07:22 PM)bplus Wrote: Do you suppose an 8x8 cell is ideal for neat looking designs? Is you Random fill 50/50?

The post #9 of this thread had cool pictures. That comes from 8x8 pixel "character block".

Otherwise it becomes too limited to represent what younger people have become accustomed to with the "emojis". Look at what had to be done to get the "open" and filled smiley-faces, and the playing card suits. Cannot look at them too closely LOL...

It needs to be greater than 8 pixels across besides being taller. Even 32x32 for icons is too restrictive sometimes in color. This is something I discovered using Windows Paint and creating an icon for FLAC. Now I don't even think about it on Linux since that allows PNG files of pretty much any square at least 16x16, and it supports transparency.
Reply
#13
Dang it, every pattern is so interesting that I can veg out on this all frigging day...

   
Reply
#14
(05-09-2023, 07:55 PM)CharlieJV Wrote:
(05-09-2023, 07:22 PM)bplus Wrote: Oh yours looks like tiling on a slant, with pixel offsets?, as opposed to filling "character cells" straight up and down or across fills.

I will try that...

Do you suppose an 8x8 cell is ideal for neat looking designs? Is you Random fill 50/50?

That should be an easy question to answer, but I'm struggling.

...

Now for chunk 2:

Code: (Select All)
  PrintTiles:
        ptrn% = INT(RND*3)
        FOR i = 1 TO 80
            SELECT CASE ptrn%
              CASE 0
                PRINT CHR$(0) + CHR$(0) + CHR$(1);
              CASE 1
                PRINT CHR$(0) + CHR$(1) + CHR$(0);
              CASE 2
                PRINT CHR$(1) + CHR$(0) + CHR$(0);
            END SELECT
        NEXT i
    RETURN


Not much special here.  Print (note the semi-colon to do no carriage return) groups of three characters 80 times.

In another bit of code, the first line is made to be blank.  3 characters 80 times, 240 characters in all.  At 20 characters per row, 12 rows of characters.  (screen being 160 pixels wide by 112 pixels tall.  Reference: BAM's screen modes.)

Code: (Select All)
SCREEN _NEWIMAGE(160, 112, 14)

Before going into the loop, we pick a pattern to use (0, 1, or 2).

I like the "rule of thirds" in photography, so each pattern has the "diagonal-flippy character" once, and the other two characters are the straight generated one.

The idea here is to make sure that however number of characters in the pattern, the total number of character-width of the screen cannot be divided neatly (i.e. there will be a remainder) by the number of characters in the pattern.  So we never have a column of text with the one character repeated throughout.  That makes for a more interesting pattern.
Reply
#15
Ah after trying to replicate your screen shots, I was correct it was more than just laying out one tile over the whole screen.

Charlie you are right, those patterns have more of an allure to them than my simple minded idea of one tile alone over whole screen. The upside down flip allows a bilateral symmetry which is more attractive to us bilateral humans but not AI I bet Smile
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#16
(05-09-2023, 09:41 PM)bplus Wrote: Ah after trying to replicate your screen shots, I was correct it was more than just laying out one tile over the whole screen.

Charlie you are right, those patterns have more of an allure to them than my simple minded idea of one tile alone over whole screen. The upside down flip allows a bilateral symmetry which is more attractive to us bilateral humans but not AI I bet Smile

Oh good, I'm glad you figured that out because the wheels were spinning over here but the hamster was getting nowhere.

Yes, bilateral symmetry, unlike my two left feet.
Reply
#17
Version two (a two-colour version to demonstrate "layering" of characters with "PutString") in the BAM: PUTSTRING prototyping thread.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  BAM Draw CharlieJV 9 1,975 11-07-2023, 10:27 PM
Last Post: James D Jarvis
  BAM: New version CharlieJV 0 485 06-29-2023, 02:22 AM
Last Post: CharlieJV
  BAM App Personalizer (a GUI to personalize BAM programs) CharlieJV 0 475 01-06-2023, 03:48 AM
Last Post: CharlieJV
  BAM FIX: disappearing BAM menu bar on mobile web browsers CharlieJV 0 473 12-11-2022, 07:00 PM
Last Post: CharlieJV
  BAM Features Set: "Powerwash", "BAM System Update", "TW System Update" CharlieJV 1 734 11-10-2022, 05:16 AM
Last Post: CharlieJV

Forum Jump:


Users browsing this thread: 1 Guest(s)