Saturday, November 25, 2023

📚 An approach to line identifiers: an emoji + number + label hybrid

NOTE: I have a cognitive disability and Fuch's Dystrophy, so finding ways to overcome both of these challenges is an on-going and ever-evolving process of continuous improvement/experimentation !

For the longest time, I used to avoid using GOTO and GOSUB because I wanted to avoid unstructured programming at all costs, GOTO and GOSUB being part of unstructured programming.

I've found myself over the last year seeing GOTO and GOSUB in a different light, often finding them useful in the context of structured programming.  As I've been increasingly making use of these statements, I've also been reevaluating my usage of line identifiers.  What I've realized:

  • I heavily dislike line numbers, because the numbers don't mean anything to me
  • I dislike line labels because they do not make it easy for me to locate the related line (when looking at a GOTO or GOSUB statement)
However:
  • I really like sequential line numbers because they help me locate (i.e. scroll to) the related line (when looking at a GOTO or GOSUB statement)
  • I really like descriptive line labels because they help me identify what I'm jumping to (two birds with one stone: serving the purpose of line identification for the program, and serving the purpose of telling the programmer what's going on (so no need to clutter the code with a comment)
So it struck me: I need line labels that give me both benefits (line number to locate the related line, and descriptive text to let me know what the GOTO or GOSUB is for.

So the format I need for line labels:  999_XXX:
  • "999" is an integer number of any length (the number can even have leading zeroes)
  • The underscore is only a suggestion (you can omit it or use any other valid character)
  • "XXX" is whatever mixture of alphabetic characters, numeric characters, emojis, and other valid characters
    • other valid characters
      • accented characters
      • exclamation mark and question mark
      • non-consecutive tildes
      • non-consecutive "tick marks"
      • # $ % |
    • INVALID characters (i.e. we cannot use these in line identifiers
      • space character
      • period and comma
      • tilde and "tick mark" (`)
      • single quote (') and double-quote (")
      • @ ^ & * ( ) - + = / \ > <  { } [ ] : ;
  • The semi-colon (:) suffix (i.e. the last character) is required
However, I've found it helpful to prefix line labels with emojis to indicate that a line identifier is part of a sequential group of identifiers.  I find this helps to quickly visually identify a group of related identifiers.

So the final format I need for line labels:❓999_XXX:
  • ❓ is whatever emoji (or even a unicode character) that is available and suitable to quickly let me know whether or not I'm in the right ballpark of code in my search for a particular line.
Here's are line identifiers from my BAM Draw program:

⚙120_do_new_drawing:
⚙130_init_program:
⚙140_prompt_height:
⚙150_prompt_width:
🖥210_refresh_canvas:
🖥220_setup_screen:
🍔310_show_menu_pick: 
🍔320_show_next_menu_item:
🍔330_toggle_menu_pick:
🖼410_do_grid:
🖼420_toggle_grid:
🖼430_undo_grid:
✒510_change_marker:
✒520_do_marking:
✒530_set_marker:
🎨610_change_color:
🎨620_show_color_menu:
🎨630_show_color_picks:
🎨640_toggle_color_menu_mode:
🔧710_do_export:
🧭810_MovL:
🧭820_MovR:
🧭830_MovU:
🧭840_MovD:

Of course, none of these line labels are that close to each other.  They are visually separated by several or more lines of code.  You'll have to verify yourself how this kind of line label format works by viewing the BAM Draw source code and searching for the lines of code that match the identifiers in GOSUB statements.



Friday, November 24, 2023

🖥 Kimmie Fishies BAM Screensaver

This BAM program is a port and substantial mod of Jason Anthony's "Kimmie Fish 2 Screensaver" QB64 program found here on SourceForge.

I've refactored the code to allow as many (user-specified at startup prompt) fishies in the aquarium as desired.  Each fish also has a 1 in 5 chance of being a very fast swimmer.



Thursday, November 23, 2023

🖥 Kimmie Fish Screensaver

This BAM program is a port of Jason Anthony's "Kimmie Fish 2 Screensaver" QB64 program found here on SourceForge.









Sunday, November 19, 2023

🎉 New version of BASIC Anywhere Machine

Summary

  • BASIC Language Updates
    • New RemoveLocalStorageItem statement
    • New NVL$ function
  • Program Console Window
    • Mouse Click: distinguishing left vs right mouse button click
  • IDE Updates
    • IDE Config: New "Font for Menus/Windows/Dialogs" setting
    • Reimplemented: Program "extra view windows"

Monday, November 13, 2023

Sine Wave with Text

This is a port of a GW-BASIC program to BAM, with additions to enable click/touch interaction in addition to keyboard interaction.

So if you have a touch device (or prefer use your mouse), then you can click on the words in the menu to trigger those actions.




Saturday, November 4, 2023

🖥 BAM Draw

BAM Draw is an in-the-works refactoring of a BAM program I created over a year ago.

I'll be using this post to track the progress of this effort.

To play with and/or view the latest version of BAM Draw, find that program in the development version of BASIC Anywhere Machine.

Please note:  BAM Draw saves your single drawing to browser local storage, so that you can edit the same drawing over multiple sessions.

2023-11-12 Version of BAM Draw (🎉 Project complete 🎉)

  • Run the program
  • View the source code
  • I switched the positions of the "quadruple hamburger" thingy down and the currently selected menu item.  When using a mouse, I don't want the mouse covering any part of the currently selected menu item when hovering over the "quadruple hamburger" thingy.
  • Otherwise, this version was about code refactoring and re-organizing.


2023-11-10 Version of BAM Draw

  • Run the program
  • View the source code
  • Added "MovL", "MovR", "MovU", "MovD" to items available via the "quadruple hamburger" thingy
    • These are meant to move the drawing, one row/column at a time, Left, Right, Up, or Down
    • Note that moving the drawing will cause the loss of a row or column; for example, moving the diagram left will:
      • overwrite the first column, with whatever is in the second column
      • whatever was in the first column no longer exists
      • so every column shifts to the left by 1
      • the right-most column will be blank
  • Also fixed bugs at programs "New drawing or continue previous drawing" prompt 


2023-11-08 Version of BAM Draw

  • Run the program
  • View the source code
  • Added "Xprt" to items available via the "quadruple hamburger" thingy.
  • "Xprt" will download the drawing as a BASIC program with the drawing in DATA statements, the DATA statements preceded by a very simple program that displays the drawing.
  • Also, this program includes a fix to the development version of BAM: the program console, when right-clicked and after closing the browser popup menu, the console was behaving as if the left mouse button was pressed and held pressed.  (See what happens, in the previous versions of this program, when you right-click on the drawing, then press the escape key on your keyboard to close the popup menu, and move the mouse around. )


2023-11-07 Version of BAM Draw

  • Run the program
  • View the source code
  • Will the program ever be complete?  Not as long as there are new features to add !  And not as long as I find code to refactor.
  • Let's say that the program is very functional.
  • I've reorganized the footer menu
    • Changed "Pen" label to "Marker" and moved it under the Background/Foreground clickable/touchable area
    • Clickable/touchable colours setup as two rows of 8 columns instead of one row of 16 columns, to take less horizontal space and allow for narrower drawings
    • The "F" and "B" labels (to indicate which colour is the foreground colour and which colour is the background colour now appear on top of the relevant colour.
    • Added a "quadruple hamburger" thingy which, when clicked, cycles through the available items displayed right below.  At startup, Grid is the available clickable item below the hamburgers thingy.  Next is "Wdth" (for width of the canvas), then "Hgth" (a typo there, for height of the canvas).
    • Tentative next feature:  export a drawing to a text file as a BASIC program with the drawing in DATA statements.



2023-11-06 Version of BAM Draw

  • Run the program
  • View the source code
  • This program is nearly complete
  • Click/touch colours in the footer menu to change brush colours
  • The colour applies to the pen component (either "Background" or "Foreground")
  • Click on the label "Background" or "Foreground" (whichever one is showing); this will toggle to the other pen component
  • The current pen Background and Foreground colours will be highlighted with "B" and "F" under the colours




2023-11-05 Version of BAM Draw

  • Run the program
  • View the source code
  • This program is now touch friendly
  • On startup, the program asks for width of canvas, then height of canvas
  • TUI (i.e. text user interface) menu bar setup as a footer on the screen
  • Pen can be chosen by clicking a key on a physical keyboard OR by clicking/touching the word "Pen" to open a prompt dialog (triggering virtual keyboards on touch devices)
  • Grid can be toggled on/off by clicking/touching the word "Grid"

 


2023-11-04 Version of BAM Draw


Usage Guide

  • Press a key on the keyboard to change the "brush" to that character
    • Set the brush to the "spacebar" character for erasing what's on the screen


    ASCII Draw


    Usage Guide

    • At the start of the program, answer the prompts for the size of the canvas
    • Click the word "background" to toggle between "background" and "foreground".
    • Click a color to set background or foreground color
    • Press a key on the keyboard to change the "brush" to that character
      • Set the brush to the "spacebar" character for erasing what's on the screen (using the currently selected background color)
    • Draw by individually clicking cells on the screen, or hold the click for continuous drawing as you move the mouse
     

     

     

    📚 FUNCTION (and SUB): variable arguments, by default, are "passed by reference"

    Preamble A primer on "call-by-reference" vs "call-by-value" BAM HOWTO (BTW:  "call-by-reference" aka "pas...