Recent Posts

Pages: 1 ... 8 9 [10]
91
VB (5/6/CE) Classic / Re: twinBASIC
« Last post by John on August 27, 2023, 10:43:06 PM »
I'm hoping I can create 32 bit form / class DLLs I can use with ScriptBasic's COM extension.
92
VB (5/6/CE) Classic / twinBASIC
« Last post by John on August 27, 2023, 07:25:24 PM »
twinBASIC: a modern, BASIC programming language, aiming for 100% backwards compatibility with existing VB6/VBA projects.  A complete replacement development environment offering significant new features and improvements over the VB6 IDE.

VBCCR is compatible with twinBASIC in 64 bit mode.

https://twinbasic.com/
93
Code Repository / Re: 2048 Challenge
« Last post by jalih on August 13, 2023, 01:39:10 AM »
I modified my 2048 game to support mobile platforms, so it now should also work with Android and iOS platforms.

Code: [Select]
\
\ 2048 game for the 8th programming language
\
needs[ nk/gui nk/buttons nk/keyboard stack/rstack ]

: init-window-size
  mobile? if
    hw:displaysize?
  else
    400 460
  then ;

init-window-size constant HEIGHT constant WIDTH

: setup-fonts
  HEIGHT 0.05 n:* dup>r dup font:system "font1" 3 a:close ["size","font","name"] swap m:zip font:new drop
  r> 1.6 n:* dup>r dup font:system "font2" 3 a:close ["size","font","name"] const swap m:zip font:new drop
  r> 1.8 n:* dup font:system "font3" 3 a:close ["size","font","name"] const swap m:zip font:new drop ;

\ Game states
0 constant PLAY
1 constant WON
2 constant GAMEOVER

[ @scan:LEFT, @scan:RIGHT, @scan:UP, @scan:DOWN ] constant CURSOR-KEYS

with: nk
: key-state-changed?  \  s a -- a
  scancode?
  ( if 1 else 0 then ) a:map over get over ?:
  rot third set
  ' n:cmp a:2map ;

: cursor-key?  \ -- n | null
  null "keystates" CURSOR-KEYS key-state-changed?
  (
    swap a:pop -1 n:= if
      rot drop break
    else
      nip
    then
  ) 0 third a:len nip n:1- loop- drop ;

4 constant GRID-SIZE
GRID-SIZE n:sqr constant GRID-SIZE-SQUARED

[[204,192,179,255],[238,228,218,255],[237,224,200,255],[242,177,121,255],
 [245,149,99,255],[246,124,95,255],[246,94,59,255],[237,207,114,255],
 [237,204,97,255],[237,200,80,255],[237,197,63,255],[237,194,46,255]] constant bg-colors

[[249,246,242,255],[119,110,101,255]] constant fg-colors

var empty-cells
nullvar tile-items
nullvar block-list

: update-empty-cells
  a:new
  ( tile-items @ over a:_@ null? if
      drop a:push
    else
      2drop
    then
  ) 0 GRID-SIZE-SQUARED n:1- loop
  empty-cells ! ;

: random-tile
  [1,1,1,1,1,1,1,1,1,2] a:len rand-pcg swap n:mod a:_@ ;

: create-new-tile
  empty-cells @
  a:len rand-pcg swap n:mod dup>r a:@ tile-items @ swap random-tile a:! drop r> a:- drop ;

: get-row-at  \ n -- a
  a:new
  ( >r tile-items @
    third GRID-SIZE n:* r@ n:+ a:_@ null? if
      drop 0 a:push
    else
      a:push
    then rdrop
  ) 0 GRID-SIZE n:1- loop nip ;

: get-column-at  \ n -- a
  a:new
  ( >r tile-items @
    r@ GRID-SIZE n:* fourth n:+ a:_@ null? if
      drop 0 a:push
    else
      a:push
    then rdrop
  ) 0 GRID-SIZE n:1- loop nip ;

: merge  \ source-row -- indices merged-row
  a:new  \ source-row non-empty-tiles
  a:new  \ source-row non-empty-tiles indices

  ( dup>r third a:len nip a:!
    third r@ a:_@ dup 0 n:> if
      third swap a:push drop
    else
      drop
    then
    rdrop
  ) 0 4 pick a:len nip n:1- loop
 
  a:new
  \ source-row non-empty-tiles indices merged-row

  ( dup>r fourth a:len nip n:1- n:= if
      third r@ a:_@ a:push
    else
      third r@ dup n:1+ 2 a:close a:_@ a:open n:= if
        ( >r over r@ a:_@ over a:len nip n:> if
            over r@ a:@ n:1- r@ swap a:! drop
          then
          rdrop
        ) 0 5 pick a:len nip n:1- loop
        third r@ a:_@ n:1+ a:push
        2 step
      else
        third r@ a:_@ a:push
      then
    then
    rdrop
  ) 0 4 pick a:len nip n:1- loop

  ( 0 a:! ) over a:len nip 5 pick a:len nip n:1- loop 2swap 2drop ;

\ block format: [index,value,target,merged,LERP]
: build-block-list
  a:new
  tile-items @
  ( null? !if
      2dup 0 5 a:close a:push
    else
      2drop
    then
  ) a:each drop
  block-list ! ;

"moved?" constant MOVED?
"blocks" constant BLOCKS
"merged-row" constant MERGED-ROW
"source-row" constant SOURCE-ROW
"indices" constant INDICES

: pre-move
  false MOVED? w:!
  a:new BLOCKS w:! ;

: post-move
  MOVED? w:@ if
    update-empty-cells create-new-tile
  then
  BLOCKS w:@ block-list ! ;

: row-col-source-merged? \ n rev? row? -- T \\ n
  rot dup>r swap if get-row-at else get-column-at then
  swap  if
    a:rev
  then
  dup SOURCE-ROW w:!
  merge MERGED-ROW w:! INDICES w:!
  SOURCE-ROW w:@ MERGED-ROW w:@
  ' n:= a:= 2nip ;
 
locals:
: move-left
  pre-move
  ( false true row-col-source-merged? !if
      true MOVED? w:!
      ( >r SOURCE-ROW w:@ r@ a:_@ 0 n:> INDICES w:@ r@ a:_@ r@ n:= not and if
          \ checks if a merge has happened and at what position
          MERGED-ROW w:@ INDICES w:@ r@ a:_@  a:_@
          SOURCE-ROW w:@ r@ a:_@ n:>
          tile-items @ GRID-SIZE 1 rpick n:* INDICES w:@ r@ a:_@ n:+ a:_@ null? if
            drop false
          else
            drop true
          then
          and if
            \ move and merge
            BLOCKS w:@
            GRID-SIZE 1 rpick n:* r@ n:+
            tile-items @ over a:_@
            GRID-SIZE 1 rpick n:* INDICES w:@ r@ a:_@ n:+
            over n:1+
            1
            5 a:close a:push drop

            tile-items @ GRID-SIZE 1 rpick n:* r@ n:+ a:@ n:1+
            GRID-SIZE 1 rpick n:* INDICES w:@ r@ a:_@ n:+ swap a:! drop
          else
            \ move
              BLOCKS w:@
              GRID-SIZE 1 rpick n:* r@ n:+
              tile-items @ over a:_@
              GRID-SIZE 1 rpick n:* INDICES w:@ r@ a:_@ n:+
              over
              1
              5 a:close a:push drop

              tile-items @ GRID-SIZE 1 rpick n:* r@ n:+ a:@
              GRID-SIZE 1 rpick n:* INDICES w:@ r@ a:_@ n:+ swap a:! drop           
          then
          tile-items @ GRID-SIZE 1 rpick n:* r@ n:+ null a:! drop
        else
          tile-items @ GRID-SIZE 1 rpick n:* r@ n:+ a:_@ null? !if           
            drop
            BLOCKS w:@
            GRID-SIZE 1 rpick n:* r@ n:+
            tile-items @ over a:_@
            2dup
            0
            5 a:close a:push drop
          else
            drop
          then
        then
        rdrop
      ) 0 SOURCE-ROW w:@ a:len nip n:1- loop
    else
      ( >r
        tile-items @ GRID-SIZE 1 rpick n:* r@ n:+ a:_@ null? !if           
          drop
          BLOCKS w:@
          GRID-SIZE 1 rpick n:* r@ n:+
          tile-items @ over a:_@
          2dup
          0
          5 a:close a:push drop
        else
          drop
        then
        rdrop
      ) 0 SOURCE-ROW w:@ a:len nip n:1- loop
    then
    rdrop
  ) 0 GRID-SIZE n:1- loop
 
  post-move ;

locals:
: move-right
  pre-move
  ( true true row-col-source-merged? !if
      true MOVED? w:!
      SOURCE-ROW w:@ a:rev SOURCE-ROW w:!
      MERGED-ROW w:@ a:rev MERGED-ROW w:!
      INDICES w:@ a:rev INDICES w:!
     
      \ recalculate the indices from the end to the start
      ( INDICES w:@ swap GRID-SIZE n:1- third third a:_@ n:- a:! drop
      ) 0 GRID-SIZE n:1- loop

      ( SOURCE-ROW w:@ a:len nip n:1- swap n:- >r
        SOURCE-ROW w:@ r@ a:_@ 0 n:> INDICES w:@ r@ a:_@ r@ n:= not and if
        \ checks if a merge has happened and at what position
        MERGED-ROW w:@ INDICES w:@ r@ a:_@  a:_@
        SOURCE-ROW w:@ r@ a:_@ n:>
        tile-items @ GRID-SIZE 1 rpick n:* INDICES w:@ r@ a:_@ n:+ a:_@ null? if
          drop false
        else
          drop true
        then
        and if
          \ move and merge
            BLOCKS w:@
            GRID-SIZE 1 rpick n:* r@ n:+
            tile-items @ over a:_@
            GRID-SIZE 1 rpick n:* INDICES w:@ r@ a:_@ n:+
            over n:1+
            1
            5 a:close a:push drop

            tile-items @ GRID-SIZE 1 rpick n:* r@ n:+ a:@ n:1+
            GRID-SIZE 1 rpick n:* INDICES w:@ r@ a:_@ n:+ swap a:! drop
          else
            \ move
              BLOCKS w:@
              GRID-SIZE 1 rpick n:* r@ n:+
              tile-items @ over a:_@
              GRID-SIZE 1 rpick n:* INDICES w:@ r@ a:_@ n:+
              over
              1
              5 a:close a:push drop

              tile-items @ GRID-SIZE 1 rpick n:* r@ n:+ a:@
              GRID-SIZE 1 rpick n:* INDICES w:@ r@ a:_@ n:+ swap a:! drop           
          then
          tile-items @ GRID-SIZE 1 rpick n:* r@ n:+ null a:! drop
        else
          tile-items @ GRID-SIZE 1 rpick n:* r@ n:+ a:_@ null? !if           
            drop
            BLOCKS w:@
            GRID-SIZE 1 rpick n:* r@ n:+
            tile-items @ over a:_@
            2dup
            0
            5 a:close a:push drop
          else
            drop
          then
        then
        rdrop
      ) 0 SOURCE-ROW w:@ a:len nip n:1- loop
    else
      ( SOURCE-ROW w:@ a:len nip n:1- swap n:- >r
        tile-items @ GRID-SIZE 1 rpick n:* r@ n:+ a:_@ null? !if           
          drop
          BLOCKS w:@
          GRID-SIZE 1 rpick n:* r@ n:+
          tile-items @ over a:_@
          2dup
          0
          5 a:close a:push drop
        else
          drop
        then
        rdrop
      ) 0 SOURCE-ROW w:@ a:len nip n:1- loop
    then
    rdrop
  ) 0 GRID-SIZE n:1- loop
 
  post-move ;

locals:
: move-up
  pre-move
  ( false false row-col-source-merged? !if
      true MOVED? w:!
      ( >r SOURCE-ROW w:@ r@ a:_@ 0 n:> INDICES w:@ r@ a:_@ r@ n:= not and if
          \ checks if a merge has happened and at what position
          MERGED-ROW w:@ INDICES w:@ r@ a:_@  a:_@
          SOURCE-ROW w:@ r@ a:_@ n:>
          tile-items @ GRID-SIZE INDICES w:@ r@ a:_@ n:* 1 rpick n:+ a:_@ null? if
            drop false
          else
            drop true
          then
          and if
            \ move and merge
            BLOCKS w:@
            GRID-SIZE r@ n:* 1 rpick n:+
            tile-items @ over a:_@
            GRID-SIZE INDICES w:@ r@ a:_@ n:* 1 rpick n:+
            over n:1+
            1
            5 a:close a:push drop

            tile-items @ GRID-SIZE r@ n:* 1 rpick n:+ a:@ n:1+
            GRID-SIZE INDICES w:@ r@ a:_@ n:* 1 rpick n:+ swap a:! drop
          else
            \ move
              BLOCKS w:@
              GRID-SIZE r@ n:* 1 rpick n:+
              tile-items @ over a:_@
              GRID-SIZE INDICES w:@ r@ a:_@ n:* 1 rpick n:+
              over
              1
              5 a:close a:push drop

              tile-items @ GRID-SIZE r@ n:* 1 rpick n:+ a:@
              GRID-SIZE INDICES w:@ r@ a:_@ n:* 1 rpick n:+ swap a:! drop           
          then
          tile-items @ GRID-SIZE r@ n:* 1 rpick n:+ null a:! drop
        else
          tile-items @ GRID-SIZE r@ n:* 1 rpick n:+ a:_@ null? !if           
            drop
            BLOCKS w:@
            GRID-SIZE r@ n:* 1 rpick n:+
            tile-items @ over a:_@
            2dup
            0
            5 a:close a:push drop
          else
            drop
          then
        then
        rdrop
      ) 0 SOURCE-ROW w:@ a:len nip n:1- loop
    else
      ( >r
        tile-items @ GRID-SIZE r@ n:* 1 rpick n:+ a:_@ null? !if           
          drop
          BLOCKS w:@
          GRID-SIZE r@ n:* 1 rpick n:+
          tile-items @ over a:_@
          2dup
          0
          5 a:close a:push drop
        else
          drop
        then
        rdrop
      ) 0 SOURCE-ROW w:@ a:len nip n:1- loop
    then
    rdrop
  ) 0 GRID-SIZE n:1- loop
 
  post-move ;

locals:
: move-down
  pre-move
  ( true false row-col-source-merged? !if
      true MOVED? w:!
      SOURCE-ROW w:@ a:rev SOURCE-ROW w:!
      MERGED-ROW w:@ a:rev MERGED-ROW w:!
      INDICES w:@ a:rev INDICES w:!
     
      \ recalculate the indices from the end to the start
      ( INDICES w:@ swap GRID-SIZE n:1- third third a:_@ n:- a:! drop
      ) 0 GRID-SIZE n:1- loop

      ( SOURCE-ROW w:@ a:len nip n:1- swap n:- >r
        SOURCE-ROW w:@ r@ a:_@ 0 n:> INDICES w:@ r@ a:_@ r@ n:= not and if
        \ checks if a merge has happened and at what position
        MERGED-ROW w:@ INDICES w:@ r@ a:_@  a:_@
        SOURCE-ROW w:@ r@ a:_@ n:>
        tile-items @ GRID-SIZE INDICES w:@ r@ a:_@ n:* 1 rpick n:+ a:_@ null? if
          drop false
        else
          drop true
        then
        and if
            \ move and merge
            BLOCKS w:@
            GRID-SIZE r@ n:* 1 rpick n:+
            tile-items @ over a:_@
            GRID-SIZE INDICES w:@ r@ a:_@ n:* 1 rpick n:+
            over n:1+
            1
            5 a:close a:push drop

            tile-items @ GRID-SIZE r@ n:* 1 rpick n:+ a:@ n:1+
            GRID-SIZE INDICES w:@ r@ a:_@ n:* 1 rpick n:+ swap a:! drop
          else
            \ move
              BLOCKS w:@
              GRID-SIZE r@ n:* 1 rpick n:+
              tile-items @ over a:_@
              GRID-SIZE INDICES w:@ r@ a:_@ n:* 1 rpick n:+
              over
              1
              5 a:close a:push drop

              tile-items @ GRID-SIZE r@ n:* 1 rpick n:+ a:@
              GRID-SIZE INDICES w:@ r@ a:_@ n:* 1 rpick n:+ swap a:! drop           
          then
          tile-items @ GRID-SIZE r@ n:* 1 rpick n:+ null a:! drop
        else
          tile-items @ GRID-SIZE r@ n:* 1 rpick n:+ a:_@ null? !if           
            drop
            BLOCKS w:@
            GRID-SIZE r@ n:* 1 rpick n:+
            tile-items @ over a:_@
            2dup
            0
            5 a:close a:push drop
          else
            drop
          then
        then
        rdrop
      ) 0 SOURCE-ROW w:@ a:len nip n:1- loop
    else
      ( >r
        tile-items @ GRID-SIZE r@ n:* 1 rpick n:+ a:_@ null? !if           
          drop
          BLOCKS w:@
          GRID-SIZE r@ n:* 1 rpick n:+
          tile-items @ over a:_@
          2dup
          0
          5 a:close a:push drop
        else
          drop
        then
        rdrop
      ) 0 SOURCE-ROW w:@ a:len nip n:1- loop
    then
    rdrop
  ) 0 GRID-SIZE n:1- loop

  post-move ;

locals:
: test-left
  false MOVED? w:!
  ( dup>r get-row-at dup SOURCE-ROW w:!
    merge MERGED-ROW w:! INDICES w:!
    SOURCE-ROW w:@ MERGED-ROW w:@ ' n:= a:= 2nip !if
      true MOVED? w:!
      break
    then
    rdrop
  ) 0 GRID-SIZE n:1- loop
 
  MOVED? w:@ ;

locals:
: test-right
  false MOVED? w:!
  ( dup>r get-row-at a:rev dup SOURCE-ROW w:!
    merge MERGED-ROW w:! INDICES w:!
    SOURCE-ROW w:@ MERGED-ROW w:@ ' n:= a:= 2nip !if
      true MOVED? w:!
      break
    then
    rdrop
  ) 0 GRID-SIZE n:1- loop
 
  MOVED? w:@ ;

locals:
: test-up
  false MOVED? w:!
  ( dup>r get-column-at dup SOURCE-ROW w:!
    merge MERGED-ROW w:! INDICES w:!
    SOURCE-ROW w:@ MERGED-ROW w:@ ' n:= a:= 2nip !if
      true MOVED? w:!
      break
    then
    rdrop
  ) 0 GRID-SIZE n:1- loop
 
  MOVED? w:@ ;

locals:
: test-down
  false MOVED? w:!
  ( dup>r get-column-at a:rev dup SOURCE-ROW w:!
    merge MERGED-ROW w:! INDICES w:!
    SOURCE-ROW w:@ MERGED-ROW w:@ ' n:= a:= 2nip !if
      true MOVED? w:!
      break
    then
    rdrop
  ) 0 GRID-SIZE n:1- loop
 
  MOVED? w:@ ;

: can-move?
  test-left test-right or
  test-up or test-down or ;

: won?
  0
  tile-items @
  ( null? !if
      11 n:= if
        1 n:bor
      then
    else
      drop
    then
  ) a:each! drop ;

: new-win
  {
    name: "main",
    wide: @WIDTH,
    high: @HEIGHT,
    resizable: false,
    bg: "white",
    title: "2048"
  } win ;

: setup
  a:new tile-items !
  ( update-empty-cells
      create-new-tile ) 2 times

  build-block-list ;

\ draws text centered inside rectangle
: centered-text  \ rect s font bg-color fg-color --
  5 a:close
  [1,2] a:@ a:open measure-font pt>rect >r
  0 a:@ r> center-rect 0 swap a:!
  a:open draw-text ;

: index>rect  \ n -- rect
  dup GRID-SIZE n:/ n:int swap
  GRID-SIZE n:mod
  1 tuck grid ;

: draw-blocks
  block-list @
  ( -1 a:@ >r
    2 a:@ index>rect rect>pos x>pt
    over 0 a:_@ index>rect tuck rect>pos x>pt
    ( r@ n:lerp ) a:2map rdrop
    third [1,3,4] a:_@ a:open 0 n:= if
      nip
    else
      drop
    then
    >r swap rect>size pt>rect swap rect-ofs dup 4 bg-colors r@ a:_@ fill-rect
    2 r@ n:^ >s "font2" bg-colors r@ a:_@ fg-colors r> 3 n:< >n a:_@ centered-text
    drop
  ) a:each! drop ;

: 101grid
  1 0 1 grid ;

: 111grid
  1 1 1 grid ;

: >grid
  101grid rect>local grid-push ;

: declare
  "font3" [238,228,218,128] fg-colors 1 a:_@ centered-text ;

: game-over
  0 101grid "Game Over" declare ;

: won
  0 101grid "You Won!" declare ;

: do-dir \ n --
  [ ' move-left , ' move-right , ' move-up , ' move-down ]
  case ;
 
: test-won won? if
    build-block-list
    "game-state" WON set
  else
    can-move? !if
      build-block-list
      "game-state" GAMEOVER set
    then
  then null do ;

: 2048-grid
  widget if
    1 1 layout-grid-begin
      0 101grid 4 [119,110,101,255] fill-rect
      0 101grid { rows: 4, cols: 4, rgap: 8, cgap: 8, margin: 8 } layout-grid-begin   
        ( >r
          ( 1 r@ 1 grid
            4 bg-colors 0 a:_@ fill-rect
          ) 0 3 loop rdrop
        ) 0 3 loop

        "game-state" get !if
          0  \ blocks moving? flag
          block-list @
          ( -1 a:@ dup if
              0.1 n:- 0 1 n:clamp -1 swap a:! drop
              1 n:bor
            else
              2drop
            then
          ) a:each! drop
          !if
            build-block-list
            cursor-key? null? !if
              do-dir test-won
            else
              drop
            then
          else
            null do   
          then
        then
        draw-blocks         
      layout-grid-end
      [ ' noop , ' won  , ' game-over ]
      "game-state" get case
    layout-grid-end
  else
    drop
  then ;

: top
  widget if
    1 1 layout-grid-begin
      0 101grid dup
        4 [119,110,101,255] fill-rect
      { rows: 1, cols: [0.75, -1], cgap: 8, margin: 8 } layout-grid-begin   
        0 101grid rect>local grid-push
          "Restart" ( setup "game-state" PLAY set ) button-label
        0 111grid rect>local grid-push
          "Quit" ' bye button-label
      layout-grid-end
    layout-grid-end
  else
    drop
  then ;

: maintain-aspect-ratio  \ rect -- rect
  dup 2 rect@ swap 3 rect@ rot n:min tuck 2 swap rect! 3 rot rect! center-rect ;

: main-render
  {
    bg: "gray",
    flags: [ @WINDOW_NO_SCROLLBAR ],
    game-state: @PLAY
  }
  begin
    null { rows: [ 0.12, -1], cols: 1, rgap: 4, margin: 0 } layout-grid-begin
      0 >grid top
      1 101grid maintain-aspect-ratio rect>local grid-push 2048-grid
    layout-grid-end
  end ;

(
  \ swipe event "d" is dir: 0=indeterminate, 1=left, 2=right, 3=up, 4=down
  "d" m:_@ 0;
  n:1- do-dir test-won
) w:is nk:swipe

: app:main
  setup-fonts setup
  new-win ' main-render -1 render-loop ;
94
Interpreters / Re: Craft Basic
« Last post by John on August 07, 2023, 12:11:34 PM »
Charles Pegge is a brilliant programmer and has done an amazing job with O2. Being open source and self compiling gives you a lot of options how you use it. ScriptBasic has an extention O2 module that gives me FFI and virtual DLLs.
95
Interpreters / Re: Craft Basic
« Last post by Gemino Smothers on August 07, 2023, 11:46:36 AM »
I have seen Oxygen Basic around and find it fascinating. From the looks of things, it may be the best BASIC compiler available.

My reason for using Emergence is mostly personal. I grew up with it and told myself in 2020 that I wanted to become proficient with it. A few years later and I have done that. My greatest project with Emergence has been Craft Basic. Unfortunately I have found out the hard way that it's a slow compiler.

For my next project, I decided to try Free Basic. Commando Basic tokenizer and interpreter is being written in Free Basic while the IDE is in Emergence. Things were going pretty well at first. I eventually found my self berated over aking questing about -qb lang syntax. So I am having trouble implementing GUI and sound beyond some simple features.

The Free Basic community has all, but totally discouraged me, but after six months of development I am struggling to survive(off grid with little power) and cannot fathom rewriting everything just yet. Need to focus my day job or starve.

I decided that I would release Commando Basic version 1 as I have done it with -qb lang. Then in a later version I will rewrite with fblite syntax and add more GUI/sound features.

The thing is I would MUCH rather switch to Oxygen Basic, so I am torn. I know it would be worth the learning curve, but the time is something I don't have right now. So I either need to refrain from releasing Commando Basic until I do an Oxygen Basic rewrite or just release it written in Free Basic. It's a hard decision because I know if I release it written with Free Basic now, it may be too hard to port to Oxygen exactly as is without changing anything.

It's been driving me nuts. Regardless, I am still working on Commando Basic and look forward to releasing it.

I want to also add that while Commando Basic will be a commercial product with a book that I plan to get an ISBN for, there will be a free version available. The free version will only include the tokenizer, interpreter, reference manual, and examples. The free version will just not include the book or IDE. That way people may use the language without a paywall if desired enough.
96
Interpreters / Re: Craft Basic
« Last post by John on August 06, 2023, 12:27:35 PM »
Oxygen Basic for Windows (16 & 32 bit) self compiling ASM BASIC compiler might make a good foundation for a BASIC interpreter.
97
Interpreters / Re: Craft Basic
« Last post by Gemino Smothers on August 06, 2023, 09:48:57 AM »
Craft Basic for Windows (written in Emergence Basic) is open source. Tiny Craft Basic for DOS (written in Quick Basic) is also open source.

Craft Basic is a direct interpreter, so execution is slow. It's main feature is expression evaluation.

Most of my software is open source.

There's one closed source project that I am currently developing called Commando Basic. It's a tokenized BASIC language that is similar, but faster than it's cousin Craft Basic. I am writing a "learn to program" book to go along with it. My goal is to release it as a commercial product. This will be my first attempt at doing such a thing. The price tag I have planned is $5.

Craft Basic will remain free and open source while I (attempt to) sell Commando Basic.
 
Many of the advancements I make with Craft Basic are going to Commando Basic and vice versa ass I am working on them at the same time. I plan to maintain these languages and provide support to the best of my ability.
98
Interpreters / Re: Craft Basic
« Last post by John on August 05, 2023, 10:10:28 PM »
Is Craft Basic an open source project?

99
Interpreters / Re: Craft Basic
« Last post by Gemino Smothers on August 03, 2023, 10:52:26 PM »
In the latest update for Craft Basic to version 1.6, there's new keywords, examples, and features.

The TAB keyword works along with the COMMA, QUOTE, and NEWLINE keywords for printing tabs in the output window.

Arrays may now be dimmed with multi line lists.

The recursion limit was raised. This ability is still limited.

The CONFIRM command provides an input dialog with a prompt, a yes button, and a no button. Yes returns 1 and no returns 0.

When defining variables, it is now optional to assign an expression or value. This way you don't have to type the = 0.

The ERASEARRAY command zeroes the contents of an array.

There's 5 new examples in version 1.6.
Top
100
Open Forum / Re: Forum Member Update
« Last post by Gemino Smothers on August 03, 2023, 10:50:16 PM »
I just updated Craft Basic. There's new keywords examples, and features. Translating Rosetta Code tasks has been helpful for testing.

This is one of the tasks I just translated. It uses the new TAB keyword. PRINT works a bit differently as there's only commas and no semicolons to separate elements. So instead of a semicolon, use the TAB keyword between the commas.
Code: [Select]
'https://rosettacode.org/wiki/Wagstaff_primes

let n = 9
let p = 1

do
let p = p + 2

if prime(p) then

let w = (2 ^ p + 1) / 3

if prime(w) then

let c = c + 1
print tab, c, tab, p, tab, w

endif

endif

wait

loop c < n

I am also working on another interpreter on the side that is tokenized and faster than Craft Basic. To go along with it, I'm writing a beginners programming book using the language.
Pages: 1 ... 8 9 [10]