• Pointers for Text Adventures

    From Jeremy Harden@21:1/5 to All on Wed Aug 10 14:58:34 2022
    I am using Gforth or pFORTH as my FORTH environment for my text adventure project, I was wondering, how do I use VERB NOUN situations with FORTH words? I theorized I make a variable (Variable verb) and then when I use a word like GET I would define it
    like so : get vget verb ! ; and if I was to use GET SWORD I would use the same get word, then sword would be : sword (using if conditions of what verbs were used before the word SWORD) ; would that be a way to do it? :)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zbig@21:1/5 to All on Wed Aug 10 15:48:36 2022
    Well, I've got „a pointer” for you: https://groups.google.com/g/comp.lang.forth/c/nWv-nm6VLcg

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans Bezemer@21:1/5 to Jeremy Harden on Thu Aug 11 02:08:11 2022
    On Wednesday, August 10, 2022 at 11:58:35 PM UTC+2, Jeremy Harden wrote:
    I am using Gforth or pFORTH as my FORTH environment for my text adventure project, I was wondering, how do I use VERB NOUN situations with FORTH words? I theorized I make a variable (Variable verb) and then when I use a word like GET I would define it
    like so : get vget verb ! ; and if I was to use GET SWORD I would use the same get word, then sword would be : sword (using if conditions of what verbs were used before the word SWORD) ; would that be a way to do it? :)

    The easiest way is to use Forths interpreter itself. You could define GET as:

    : sword cr ." Ho, ho, ho! I got a sword now!" cr ;
    : GET PARSE-NAME 2DUP S" sword" COMPARE IF CR ." I don't know what to do with a " TYPE CR ELSE 2DROP sword THEN ;

    get sword
    Ho, ho, ho! I got a sword now!
    ok
    get hammer
    I don't know what to do with a hammer
    ok

    Of course, you have to elaborate this a bit if there are more things to pick up ;-)

    Hans Bezemer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans Bezemer@21:1/5 to Hans Bezemer on Thu Aug 11 02:58:21 2022
    On Thursday, August 11, 2022 at 11:08:12 AM UTC+2, Hans Bezemer wrote:
    Of course, you have to elaborate this a bit if there are more things to pick up ;-)
    BTW, the easiest way to do that is to hash the string and use CASE..ENDCASE as a dispatcher, e.g.

    s" sword" fnv1a CONSTANT SWORD#
    s" shield" fnv1a CONSTANT SHIELD#
    s" uzi" fnv1a CONSTANT UZI#

    : GET
    PARSE-NAME 2DUP fnv1a
    CASE
    SWORD# OF SWORD ENDOF ( words need to determine what do do with the string!)
    SHIELD# OF SHIELD ENDOF
    UZI# OF UZI ENDOF
    -ROT CR ." I don't know what to do with a " TYPE CR
    ENDCASE
    ;

    UNTESTED <<

    It's much neater to do a table of course, but that's a bit harder.

    Hans Bezemer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans Bezemer@21:1/5 to All on Thu Aug 11 04:34:34 2022
    On Thursday, August 11, 2022 at 11:58:23 AM UTC+2, Hans Bezemer wrote:
    BTW, recently I used virtually the same technique in this thingy: https://rosettacode.org/wiki/RCRPG/uBasic-4tH
    May be if can give you some inspiration.

    Yeah, I copied Forth's parser. Sue me.

    Hans Bezemer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zbig@21:1/5 to All on Thu Aug 11 07:32:15 2022
    It's much neater to do a table of course, but that's a bit harder.

    Maybe, but „the sword” — or, in general, the argument — is rather secondary
    question. The primary question is: what if the player types TAKE instead
    of GET? And the answer is: an ABORT will be performed, ruining the game.

    So yes, it is tempting to use Forth interpreter, which is already here, ready for use,
    but it's not quite prepared for gaming purposes.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marcel Hendrix@21:1/5 to Zbig on Thu Aug 11 09:18:52 2022
    On Thursday, August 11, 2022 at 4:32:16 PM UTC+2, Zbig wrote:
    It's much neater to do a table of course, but that's a bit harder.
    Maybe, but „the sword” — or, in general, the argument — is rather secondary
    question. The primary question is: what if the player types TAKE instead
    of GET? And the answer is: an ABORT will be performed, ruining the game.

    So yes, it is tempting to use Forth interpreter, which is already here, ready for use,
    but it's not quite prepared for gaming purposes.

    Use a VOCABULARY / WORDLIST with only the allowed key words
    and catch problems with CATCH.
    Examples are here: http://forth-ig.nl/vijgebladarchief/ .

    -marcel

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From minforth@arcor.de@21:1/5 to Zbig on Thu Aug 11 09:27:19 2022
    Zbig schrieb am Donnerstag, 11. August 2022 um 16:32:16 UTC+2:
    It's much neater to do a table of course, but that's a bit harder.
    Maybe, but „the sword” — or, in general, the argument — is rather secondary
    question. The primary question is: what if the player types TAKE instead
    of GET? And the answer is: an ABORT will be performed, ruining the game.

    So yes, it is tempting to use Forth interpreter, which is already here, ready for use,
    but it's not quite prepared for gaming purposes.

    Today Lua is past its heydays, but its coroutine concept https://www.lua.org/pil/9.html
    is still impressive.

    Basically it is cooperative multitasking that has many similarities with the old
    Forth multitasking concept. That Standard Forth offers no wordset for it
    had been and still is very unfortunate.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans Bezemer@21:1/5 to Zbig on Thu Aug 11 09:55:11 2022
    On Thursday, August 11, 2022 at 4:32:16 PM UTC+2, Zbig wrote:
    The primary question is: what if the player types TAKE instead
    of GET? And the answer is: an ABORT will be performed, ruining the game.
    RTFM. That'll learn them to stick to the provided vocabulary AND FOLLOW INSTRUCTIONS!

    Hans Bezemer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Doug Hoffman@21:1/5 to Jeremy Harden on Thu Aug 11 13:47:40 2022
    On 8/10/22 5:58 PM, Jeremy Harden wrote:
    I am using Gforth or pFORTH as my FORTH environment for my text
    adventure project, I was wondering, how do I use VERB NOUN situations
    with FORTH words? I theorized I make a variable (Variable verb) and
    then when I use a word like GET I would define it like so : get vget
    verb ! ; and if I was to use GET SWORD I would use the same get word,
    then sword would be : sword (using if conditions of what verbs were
    used before the word SWORD) ; would that be a way to do it? :)
    An objects extension using the VERB NOUN format would seem to fit.

    Your verbs would be message names, nouns would be object names.

    See Andrew McKewan's Neon objects extension:

    ftp://ftp.taygeta.com/pub/Forth/Applications/ANS/CLASS10.ZIP

    -Doug

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From S Jack@21:1/5 to Jeremy Harden on Thu Aug 11 12:07:02 2022
    On Wednesday, August 10, 2022 at 4:58:35 PM UTC-5, Jeremy Harden wrote:
    I am using Gforth or pFORTH as my FORTH environment for my text adventure project, I was wondering, how

    The following won't work in standard Forth but may give you some ideas:

    [#] demo_advent.f -- Adventure
    --.
    anew DEMOJOB
    [r] Config
    16 TABSTOP !
    --.
    [r] Constants and variables
    ( ACTIONS )
    0 CONST TAKE ' TAKE aka GRAB ' TAKE aka GET
    1 CONST DISCARD
    2 CONST EAT
    3 CONST DRINK
    4 CONST WALK ' WALK aka GO

    40 VAR CALORIC
    30 VAR HYDRATE
    50 VAR HEALTH
    00 VAR vGOLD
    00 VAR vFOOD
    00 VAR vWATER
    00 VAR vIT
    --.
    [r] Health adjustments
    : -HEALTH ( n -- ) MINUS HEALTH @ + 0 MAX HEALTH ! ;
    : -HYDRATE ( n -- ) MINUS HYDRATE @ + 0 MAX HYDRATE ! ;
    : -CALORIC ( n -- ) MINUS CALORIC @ + 0 MAX CALORIC ! ;
    : +HEALTH ( n -- ) HEALTH @ + 100 MIN HEALTH ! ;
    : +HYDRATE ( n -- ) HYDRATE @ + 100 MIN HYDRATE ! ;
    : +CALORIC ( n -- ) CALORIC @ + 100 MIN CALORIC ! ;
    --.
    [r] Actions
    : .NAME $0 ID. ;
    : .NAME! .NAME 1 CUB ." ! " ;

    : GET_IT .NAME ." taken. " ;
    : GIVE_IT .NAME ." discarded. " ;
    : YUM .NAME ." is yummy. "
    -3 &3 +! 10 +CALORIC ;
    : FRESH ." ah, " .NAME ." is refreshing. "
    -3 &3 +! 10 +HYDRATE ;
    : CANT ." ? cannot do that. " ;
    : DUH ." You're a little confused. " ;
    : HAVE_IT $1 IF ." Have too much " .NAME!
    II $3 1 > IF ." Have too many " .NAME!
    II ." Have " .NAME ." already! "
    FI
    FI ;
    : NO_HAVE $1 IF ." Don't have anymore " .NAME!
    II $3 1 > IF ." Don't have any " .NAME!
    II ." Don't have a " .NAME!
    FI
    FI ;

    : NONE_HERE 2 spaces ." No " .NAME ." here!" ;
    : ?GET $2 $3 - IF GET_IT 1 &3 +! II HAVE_IT FI ;
    : (GETW) $2 $3 - IF GET_IT 10 &3 +! II HAVE_IT FI ;
    : (GETF) $2 $3 - IF GET_IT 10 &3 +! II HAVE_IT FI ;
    : ?DROP $3 0> IF GIVE_IT -1 &3 +! II 0 &3 ! NO_HAVE FI ;
    : ?DROPW $3 0> IF GIVE_IT -10 &3 +! II 0 &3 ! NO_HAVE FI ;
    : ?DROPF $3 0> IF GIVE_IT -10 &3 +! II 0 &3 ! NO_HAVE FI ;
    : ?DRINK $3 0> IF FRESH -1 &3 +! II 0 &3 ! NO_HAVE FI ;
    : ?EAT $3 0> IF YUM -1 &3 +! II 0 &3 ! NO_HAVE FI ;
    : ?GETG vGOLD @ ?DUP IF GET_IT &3 +! 0 vGOLD ! II NONE_HERE FI ;
    : ?GETF vFOOD @ ?DUP IF (GETF) &3 +! 0 vFOOD ! II NONE_HERE FI ;
    : ?GETW vWATER @ ?DUP IF (GETW) &3 +! 0 vWATER ! II NONE_HERE FI ;
    : GETIT vIT @ ?DUP IF GET SWAP EXECUTE II SP!! DUH FI ;
    --.
    [r] OBJECT
    : OBJECT
    BUILD
    LATEST , , \ name (nfa) and type (1 is consumable)
    , , \ count , max_count
    , , , , \ actions: take drop eat drink
    DOES SET
    POS OUT ! DROP TAB
    DUP 4 0 WITHIN IF DUH SP!! II &4 [] EXECUTE FI
    0 out !
    quit
    ;
    --.
    [r] Objects
    -- $7 $6 $5 $4 $3 $2 $1
    -- drink eat drop take Quan MaxQuan Type
    ' cant ' cant ' ?drop ' ?get 0 3 0 OBJECT KEYS
    ' cant ' cant ' ?drop ' ?get 0 1 0 OBJECT LAMP
    ' duh ' ?eat ' ?dropF ' ?getF 20 100 1 OBJECT FOOD
    ' ?drink ' duh ' ?dropW ' ?getW 20 50 1 OBJECT WATER
    ' cant ' cant ' ?drop ' ?getG 0 100 0 OBJECT GOLD
    ' cant ' cant ' cant ' getIT 0 0 0 OBJECT IT
    --.
    [r] Messages
    : GOLDPIECES 3 ' GOLD dfa [] . ." gold pieces! " ;
    : Q cr cr ." You leave with " GOLDPIECES bye ;
    : DEMISE cr cr ." You died, leaving " GOLDPIECES bye ;

    : DAMAGE ( n -- )
    DICE + DUP -HEALTH
    2 SPACES ." You sustain " . ." points of damage! "
    CR
    ;
    : WELLMSG OUT @ 55 < IF 2 SPACES II CR FI TELL ;
    : HUNGERMSG 2 SPACES TELL ;
    : THIRSTMSG 2 SPACES TELL ;
    : GODMSG TAB TELL ;
    --.
    [r] Wellness queries
    [r] ?HUNGER
    : ?HUNGER CALORIC SET
    $0 01 < IF " Starved! " HUNGERMSG 8 -HEALTH EXIT FI
    $0 10 < IF " Starving! " HUNGERMSG 3 -HEALTH EXIT FI
    $0 20 < IF " You're hungry! " HUNGERMSG EXIT FI
    $0 90 > IF " Too full! " HUNGERMSG 2 -HEALTH EXIT FI
    ;
    --.
    [r] ?THIRST
    : ?THIRST HYDRATE SET
    $0 01 < IF " De-hydrated! " THIRSTMSG 8 -HEALTH EXIT FI
    $0 10 < IF " Dying of thirst! " THIRSTMSG 3 -HEALTH EXIT FI
    $0 20 < IF " Your're thirsty! " THIRSTMSG EXIT FI
    $0 90 > IF " Too bloated! " THIRSTMSG 2 -HEALTH EXIT FI
    ;
    --.
    [r] ?FITNESS
    : ?FITNESS HEALTH SET
    $0 01 < IF DEMISE FI
    $0 10 < IF "Your're not well!" WELLMSG EXIT FI
    ;
    --.
    [r] ?GOD weather conditions
    : ?GOD dice CASE
    2 of "Severe thunder storms! " GODMSG 2 -HEALTH 2 -CALORIC
    endof
    3 of "Strong wind , severe gusts! " GODMSG 2 -HYDRATE 1 -CALORIC
    endof
    4 of "Dreary , overcast and damp! " GODMSG 1 -HEALTH 1 -CALORIC
    endof
    12 of "Balmy day, sunny and clear. " GODMSG 1 +HEALTH
    endof
    "Nice day for travel. " GODMSG
    ENDCASE
    ;
    --.
    --.
    [r] BATTLEMSG
    : BATTLEMSG
    DICE CASE
    2 of 10 "Prince attacks from above bolder! " endof
    3 of 9 "You fall in a pit of vipers! " endof
    4 of 3 "CLEO leaps out of a bush and attacks! " endof
    5 of 2 "The bridge you're on collapes! " endof
    6 of 1 "Crased Karen throws tree frogs at you!" endof
    7 of 0 "Willie bites your leg! " endof
    8 of 1 "You're stuck in quick sand! " endof
    9 of 2 "You step on bunji sticks! " endof
    10 of 3 "Red headed witch clubs you with broom!" endof
    11 of 9 "Hit by a swining log booby trap! " endof
    12 of 10 "Bart tramples you while chasing Lulu! " endof
    ENDCASE
    ;
    --.
    [r] FORTUNEMSG
    : FORTUNEMSG
    DICE CASE
    2 of 10 vGOLD ! ' GOLD vIT ! "Gold coins glimmer in stream!" endof
    3 of 10 vWATER ! ' WATER vIT ! "Nearby is spring of fresh water!" endof
    4 of 3 vWATER ! ' WATER vIT ! "Pail of water by old well!" endof
    5 of 3 vFOOD ! ' FOOD vIT ! "FOOD lies on a bench." endof
    6 of 1 vFOOD ! ' FOOD vIT ! "Bush with blue berries." endof
    7 of 1 vWATER ! ' WATER vIT ! "Water bottle hangs in tree." endof
    8 of 1 vWATER ! ' WATER vIT ! "Water in rock cup." endof
    9 of 3 vFOOD ! ' FOOD vIT ! "Mushrooms on decaying logs." endof
    10 of 3 vGOLD ! ' GOLD vIT ! "Gold coins lie on the ground." endof
    11 of 10 vFOOD ! ' FOOD vIT ! "A sack of food is hidden in the bush!" endof
    12 of 10 vGOLD ! ' GOLD vIT ! "Gold coins found in a can!" endof
    ENDCASE
    ;
    --.
    [r] Battles and Fortunes
    : FORTUNE CR FORTUNEMSG TELL ;
    : BATTLE CR BATTLEMSG TELL DAMAGE ;
    : ?LUCK
    DIE CASE
    2 of FORTUNE endof
    3 of BATTLE endof
    4 of FORTUNE endof
    ENDCASE
    ;
    --.
    [r] TRAVEL

    : TRAVEL
    BUILD
    , \ direction of travel 0N,1E,2S,3W,4U,5D
    DOES SET
    0 vGOLD ! 0 vFOOD ! 0 vWATER ! 0 vIT !
    DROP POS OUT ! DROP
    3 -CALORIC
    3 -HYDRATE
    ?GOD ?HUNGER ?THIRST ?FITNESS
    ?LUCK
    HEALTH @ 10 80 WITHIN IF 1 +HEALTH FI
    0 out !
    quit
    ;
    --.
    [r] Directions
    0 TRAVEL NORTH
    1 TRAVEL EAST
    2 TRAVEL SOUTH
    3 TRAVEL WEST
    4 TRAVEL UP
    5 TRAVEL DOWN
    6 TRAVEL ON
    --.
    [r] Displays
    : STATS
    CR ." CALORIES: " CALORIC ?
    TAB ." HYDRATION: " HYDRATE ?
    TAB ." HEALTH: " HEALTH ?
    ;

    : RATIONS
    CR ." FOOD: " 3 ' FOOD DFA [] .
    TAB ." WATER: " 3 ' WATER DFA [] .
    ;
    --.
    [r] Conflicting words
    -- Words defined here may conflict with existing Forth words
    ( Actions )
    ' DISCARD aka DROP \ here to avoid name conflict with FORTH:DROP;
    \ other action defined at top of file
    --.
    [r] Shortcuts
    : j WALK ON ;
    : gn GO NORTH ;
    : gs GO SOUTH ;
    : gu GO UP ;
    : gd GO DOWN ;
    : ge GO EAST ;
    : gw GO WEST ;
    : g GET IT ;
    : d DRINK WATER ;
    : e EAT FOOD ;
    --.
    NANOSEC SEED !
    [r] Program intro
    h0 Xavi and Willie's awsome adventure
    cr
    .(
    You are Xavi and you are bo.oo.red. So you call your dog
    Willie and say "Willie, I'm bored. Lets go for a walk."
    And so begins the awsome adventue of Xavi and his wonder
    dog Willie.
    But please, Xavi, try not to step on Willie; he might bite!
    )
    --.
    pause
    [r] Program usage
    .(

    usage: Action Object | WALK Direction | STATS | RATIONS | Q

    Objects: KEYS LAMP FOOD WATER GOLD

    Actions: TAKE GRAB GET
    DROP DISCARD
    EAT DRINK

    Travel: WALK
    Directions: North South East West Up Down On

    STATS Show health factors
    RATIONS Show provisions
    )
    pause
    .(

    Shortcuts:
    j WALK ON
    gn GO NORTH
    gs GO SOUTH
    gu GO UP
    gd GO DOWN
    ge GO EAST
    gw GO WEST
    g GET IT
    d DRINK WATER
    e EAT FOOD

    q QUIT

    )
    --.
    cr
    --.
    [#] //
    --
    me

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Zbig on Fri Aug 12 12:02:19 2022
    On 12/08/2022 00:32, Zbig wrote:
    It's much neater to do a table of course, but that's a bit harder.

    Maybe, but „the sword” — or, in general, the argument — is rather secondary
    question. The primary question is: what if the player types TAKE instead
    of GET? And the answer is: an ABORT will be performed, ruining the game.

    So yes, it is tempting to use Forth interpreter, which is already here, ready for use,
    but it's not quite prepared for gaming purposes.

    Determination beats reason every time. Infocom solved it 40 years ago.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kerr-Mudd, John@21:1/5 to dxforth on Fri Aug 12 09:44:40 2022
    On Fri, 12 Aug 2022 12:02:19 +1000
    dxforth <dxforth@gmail.com> wrote:

    On 12/08/2022 00:32, Zbig wrote:
    It's much neater to do a table of course, but that's a bit harder.

    Maybe, but „the sword” — or, in general, the argument — is rather secondary
    question. The primary question is: what if the player types TAKE instead
    of GET? And the answer is: an ABORT will be performed, ruining the game.

    So yes, it is tempting to use Forth interpreter, which is already here, ready for use,
    but it's not quite prepared for gaming purposes.

    Determination beats reason every time. Infocom solved it 40 years ago.


    Other text game adventure systems are available; It might be fun, but it's still wheel-reinventing.


    --
    Bah, and indeed Humbug.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to John on Sat Aug 13 14:42:15 2022
    On 12/08/2022 18:44, Kerr-Mudd, John wrote:
    On Fri, 12 Aug 2022 12:02:19 +1000
    dxforth <dxforth@gmail.com> wrote:

    On 12/08/2022 00:32, Zbig wrote:
    It's much neater to do a table of course, but that's a bit harder.

    Maybe, but „the sword” — or, in general, the argument — is rather secondary
    question. The primary question is: what if the player types TAKE instead >>> of GET? And the answer is: an ABORT will be performed, ruining the game. >>>
    So yes, it is tempting to use Forth interpreter, which is already here, ready for use,
    but it's not quite prepared for gaming purposes.

    Determination beats reason every time. Infocom solved it 40 years ago.


    Other text game adventure systems are available; It might be fun, but it's still wheel-reinventing.

    Indeed there are. What's bothering is the premise: 'Oh, but it should be possible to use the forth interpreter for that'. Suddenly it becomes about forth proving itself rather than identifying the needs of the application.
    I'm sure cute things can be done with the forth interpreter. I just question the priority.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans Bezemer@21:1/5 to John on Sat Aug 13 05:17:08 2022
    On Friday, August 12, 2022 at 10:44:39 AM UTC+2, Kerr-Mudd, John wrote:
    Other text game adventure systems are available; It might be fun, but it's still wheel-reinventing.
    Sure. I've done MANY - most recently one for Rosetta Codes RCRPG: https://rosettacode.org/wiki/RCRPG/uBasic-4tH

    - This is one of the oldest for 4tH: https://sourceforge.net/p/forth-4th/code/HEAD/tree/trunk/4th.src/venture.4th
    - I've even done a meta one: where you can design adventures by using a humble textfile:
    https://sourceforge.net/p/forth-4th/code/HEAD/tree/trunk/4th.src/simpladv.4th and https://sourceforge.net/p/forth-4th/code/HEAD/tree/trunk/4th.src/apps/simpladv/theend.chs

    But that's not the point here, I guess. It's not about the adventure, it's about the voyage.
    About "can I do that". About learning. Not about "you've seen it all before".

    Hans Bezemer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Hans Bezemer on Sun Aug 14 21:27:53 2022
    On 12/08/2022 02:55, Hans Bezemer wrote:
    On Thursday, August 11, 2022 at 4:32:16 PM UTC+2, Zbig wrote:
    The primary question is: what if the player types TAKE instead
    of GET? And the answer is: an ABORT will be performed, ruining the game.

    RTFM. That'll learn them to stick to the provided vocabulary AND FOLLOW INSTRUCTIONS!

    But how do you stop the forth interpreter handling numbers :)
    Case-sensitivity, number handling etc IMO conspire to make it
    problematic for serious apps.

    I had a quick look at venture.4th. While it uses the forth
    interpreter, AFAICS it does so very minimally - something
    that could be emulated without the quirks of forth?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Brian Fox@21:1/5 to dxforth on Mon Aug 15 06:10:35 2022
    On Sunday, August 14, 2022 at 7:27:56 AM UTC-4, dxforth wrote:
    On 12/08/2022 02:55, Hans Bezemer wrote:
    On Thursday, August 11, 2022 at 4:32:16 PM UTC+2, Zbig wrote:
    The primary question is: what if the player types TAKE instead
    of GET? And the answer is: an ABORT will be performed, ruining the game.

    RTFM. That'll learn them to stick to the provided vocabulary AND FOLLOW INSTRUCTIONS!
    But how do you stop the forth interpreter handling numbers :) Case-sensitivity, number handling etc IMO conspire to make it
    problematic for serious apps.

    I had a quick look at venture.4th. While it uses the forth
    interpreter, AFAICS it does so very minimally - something
    that could be emulated without the quirks of forth?

    I never understood the tendency to avoid writing a new interpreter loop
    in a case like this.
    Since Forth exposes all the component parts it's pretty simple to
    write your own and remove compilation, add a custom error handler
    or whatever you need.

    Is that just considered bad form?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From minforth@arcor.de@21:1/5 to Brian Fox on Mon Aug 15 07:35:18 2022
    Brian Fox schrieb am Montag, 15. August 2022 um 15:10:36 UTC+2:
    On Sunday, August 14, 2022 at 7:27:56 AM UTC-4, dxforth wrote:
    On 12/08/2022 02:55, Hans Bezemer wrote:
    On Thursday, August 11, 2022 at 4:32:16 PM UTC+2, Zbig wrote:
    The primary question is: what if the player types TAKE instead
    of GET? And the answer is: an ABORT will be performed, ruining the game.

    RTFM. That'll learn them to stick to the provided vocabulary AND FOLLOW INSTRUCTIONS!
    But how do you stop the forth interpreter handling numbers :) Case-sensitivity, number handling etc IMO conspire to make it
    problematic for serious apps.

    I had a quick look at venture.4th. While it uses the forth
    interpreter, AFAICS it does so very minimally - something
    that could be emulated without the quirks of forth?
    I never understood the tendency to avoid writing a new interpreter loop
    in a case like this.
    Since Forth exposes all the component parts it's pretty simple to
    write your own and remove compilation, add a custom error handler
    or whatever you need.

    Is that just considered bad form?

    Even in crippled standard Forth:
    WORDLIST VALUE myapp
    GET-ORDER 1+ myapp SWAP SET-ORDER DEFINITIONS
    < my application words >
    myapp 1 SET-ORDER

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zbig@21:1/5 to All on Mon Aug 15 10:04:17 2022
    Even in crippled standard Forth:
    WORDLIST VALUE myapp

    Actually which of twenty (or so) standards of Forth you mean ("WORDLIST"?)?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From minforth@arcor.de@21:1/5 to Zbig on Mon Aug 15 12:11:41 2022
    Zbig schrieb am Montag, 15. August 2022 um 19:04:19 UTC+2:
    Even in crippled standard Forth:
    WORDLIST VALUE myapp
    Actually which of twenty (or so) standards of Forth you mean ("WORDLIST"?)?

    http://www.forth200x.org/documents/forth-2012.pdf
    page 168

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Brian Fox on Tue Aug 16 13:33:00 2022
    On 15/08/2022 23:10, Brian Fox wrote:
    On Sunday, August 14, 2022 at 7:27:56 AM UTC-4, dxforth wrote:
    On 12/08/2022 02:55, Hans Bezemer wrote:
    On Thursday, August 11, 2022 at 4:32:16 PM UTC+2, Zbig wrote:
    The primary question is: what if the player types TAKE instead
    of GET? And the answer is: an ABORT will be performed, ruining the game. >>>
    RTFM. That'll learn them to stick to the provided vocabulary AND FOLLOW INSTRUCTIONS!
    But how do you stop the forth interpreter handling numbers :)
    Case-sensitivity, number handling etc IMO conspire to make it
    problematic for serious apps.

    I had a quick look at venture.4th. While it uses the forth
    interpreter, AFAICS it does so very minimally - something
    that could be emulated without the quirks of forth?

    I never understood the tendency to avoid writing a new interpreter loop
    in a case like this.
    Since Forth exposes all the component parts it's pretty simple to
    write your own and remove compilation, add a custom error handler
    or whatever you need.

    Is that just considered bad form?

    The opposite question - when does using the forth interpreter amount to
    bad form? IMO when it's used only trivially and/or poses a security risk.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Hans Bezemer on Tue Aug 16 16:37:36 2022
    On 13/08/2022 22:17, Hans Bezemer wrote:
    ...
    - This is one of the oldest for 4tH: https://sourceforge.net/p/forth-4th/code/HEAD/tree/trunk/4th.src/venture.4th

    FWIW here's a mostly working conversion to Standard Forth:

    https://pastebin.com/tR9gCP4E

    Due to PC problems will need to leave it to others to iron out remaining issues.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to dxforth on Tue Aug 16 18:22:54 2022
    On 16/08/2022 16:37, dxforth wrote:
    On 13/08/2022 22:17, Hans Bezemer wrote:
    ... - This is one of the oldest for 4tH: https://sourceforge.net/p/forth-4th/code/HEAD/tree/trunk/4th.src/venture.4th

    FWIW here's a mostly working conversion to Standard Forth:

    https://pastebin.com/tR9gCP4E

    Due to PC problems will need to leave it to others to iron out remaining issues.

    SwiftForth crashing was due to 'BL PARSE-WORD' in DECODE.
    Replace with: BL WORD COUNT

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stephen Pelc@21:1/5 to Brian Fox on Tue Aug 16 09:21:02 2022
    On 15 Aug 2022 at 15:10:35 CEST, "Brian Fox" <brian.fox@brianfox.ca> wrote:

    I never understood the tendency to avoid writing a new interpreter loop
    in a case like this.
    Since Forth exposes all the component parts it's pretty simple to
    write your own and remove compilation, add a custom error handler
    or whatever you need.

    I have faced this situation many times. The worst case comes from third
    party libraries which install their own number handlers and/or recognisers.
    You can see this in code that requires a specific OOP package that conflicts with your system's default OOP package.

    With the adoption of recognisers and cafeful use of search orders it is now possible to write text interpreters that can both be installed and
    uninstalled.
    The uninstall case is the important one.

    MPE's VFX Forths include code that allows for uninstalling recognisers.

    It will take a few more years until consensus for a default notation has been discussed and a solution has been accepted.

    Stephen
    --
    Stephen Pelc, stephen@vfxforth.com
    MicroProcessor Engineering, Ltd. - More Real, Less Time
    133 Hill Lane, Southampton SO15 5AF, England
    tel: +44 (0)23 8063 1441, +44 (0)78 0390 3612,
    +34 649 662 974
    http://www.mpeforth.com - free VFX Forth downloads

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From none) (albert@21:1/5 to brian.fox@brianfox.ca on Tue Aug 16 14:04:24 2022
    In article <ad8aba6e-288b-4aa2-b25f-da1bcbc1bfc4n@googlegroups.com>,
    Brian Fox <brian.fox@brianfox.ca> wrote:
    On Sunday, August 14, 2022 at 7:27:56 AM UTC-4, dxforth wrote:
    On 12/08/2022 02:55, Hans Bezemer wrote:
    On Thursday, August 11, 2022 at 4:32:16 PM UTC+2, Zbig wrote:
    The primary question is: what if the player types TAKE instead
    of GET? And the answer is: an ABORT will be performed, ruining the game. >> >
    RTFM. That'll learn them to stick to the provided vocabulary AND
    FOLLOW INSTRUCTIONS!
    But how do you stop the forth interpreter handling numbers :)
    Case-sensitivity, number handling etc IMO conspire to make it
    problematic for serious apps.

    I had a quick look at venture.4th. While it uses the forth
    interpreter, AFAICS it does so very minimally - something
    that could be emulated without the quirks of forth?

    I never understood the tendency to avoid writing a new interpreter loop
    in a case like this.
    Since Forth exposes all the component parts it's pretty simple to
    write your own and remove compilation, add a custom error handler
    or whatever you need.

    Is that just considered bad form?

    Case in point. I published a complete Pascal parser with a
    few hooks in the base system (basically redefining the characters
    that could end a word, in addition to space) and the PREFIX
    word.
    See previous messages.

    Groetjes Albert
    --
    "in our communism country Viet Nam, people are forced to be
    alive and in the western country like US, people are free to
    die from Covid 19 lol" duc ha
    albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From none) (albert@21:1/5 to the.beez.speaks@gmail.com on Tue Aug 16 15:05:38 2022
    In article <493e4b2e-3e18-4601-b6f3-f57e3b4f47dcn@googlegroups.com>,
    Hans Bezemer <the.beez.speaks@gmail.com> wrote:
    On Friday, August 12, 2022 at 10:44:39 AM UTC+2, Kerr-Mudd, John wrote:
    Other text game adventure systems are available; It might be fun, but it's >> still wheel-reinventing.
    Sure. I've done MANY - most recently one for Rosetta Codes RCRPG: >https://rosettacode.org/wiki/RCRPG/uBasic-4tH

    - This is one of the oldest for 4tH: >https://sourceforge.net/p/forth-4th/code/HEAD/tree/trunk/4th.src/venture.4th >- I've even done a meta one: where you can design adventures by using a >humble textfile: >https://sourceforge.net/p/forth-4th/code/HEAD/tree/trunk/4th.src/simpladv.4th >and >https://sourceforge.net/p/forth-4th/code/HEAD/tree/trunk/4th.src/apps/simpladv/theend.chs

    But that's not the point here, I guess. It's not about the adventure, it's >about the voyage.
    About "can I do that". About learning. Not about "you've seen it all before".

    With all due respect, a game is only valuable, if it is worth playing.
    You should not embark on a game unless you have a great idea.
    (Except exercises.)
    See games.html on my site below.


    Hans Bezemer

    Groetjes Albert
    --
    "in our communism country Viet Nam, people are forced to be
    alive and in the western country like US, people are free to
    die from Covid 19 lol" duc ha
    albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From none) (albert@21:1/5 to dxforth@gmail.com on Tue Aug 16 15:01:40 2022
    In article <td7a35$138s$1@gioia.aioe.org>, dxforth <dxforth@gmail.com> wrote: >On 12/08/2022 18:44, Kerr-Mudd, John wrote:
    On Fri, 12 Aug 2022 12:02:19 +1000
    dxforth <dxforth@gmail.com> wrote:

    On 12/08/2022 00:32, Zbig wrote:
    It's much neater to do a table of course, but that's a bit harder.

    Maybe, but „the sword” — or, in general, the argument — is
    rather secondary
    question. The primary question is: what if the player types TAKE instead >>>> of GET? And the answer is: an ABORT will be performed, ruining the game. >>>>
    So yes, it is tempting to use Forth interpreter, which is already
    here, ready for use,
    but it's not quite prepared for gaming purposes.

    Determination beats reason every time. Infocom solved it 40 years ago.


    Other text game adventure systems are available; It might be fun, but it's >> still wheel-reinventing.

    Indeed there are. What's bothering is the premise: 'Oh, but it should be >possible to use the forth interpreter for that'. Suddenly it becomes about >forth proving itself rather than identifying the needs of the application. >I'm sure cute things can be done with the forth interpreter. I just question >the priority.


    In my ciasdis assembler a mnemonic ( LEA, ) change the state of the
    system and the words understood/accepted are different.
    Like wise GET should switch to a wordlist which contains items like
    a SWORD and maybe items present in the location.

    If you start with
    1 CONSTANT SWORD
    you're on the wrong road.

    It is just that the most simple way is using the Forth interpreter.
    You can map the game syntax first, otherwise you don't know what
    you're doing.

    A great example is the BASIC interpreter that goes back to Chuck
    Moore (IIRC).

    Groetjes Albert
    --
    "in our communism country Viet Nam, people are forced to be
    alive and in the western country like US, people are free to
    die from Covid 19 lol" duc ha
    albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to albert on Wed Aug 17 00:07:29 2022
    On 16/08/2022 23:01, albert wrote:
    In article <td7a35$138s$1@gioia.aioe.org>, dxforth <dxforth@gmail.com> wrote:
    On 12/08/2022 18:44, Kerr-Mudd, John wrote:
    On Fri, 12 Aug 2022 12:02:19 +1000
    dxforth <dxforth@gmail.com> wrote:

    On 12/08/2022 00:32, Zbig wrote:
    It's much neater to do a table of course, but that's a bit harder.

    Maybe, but „the sword” — or, in general, the argument — is
    rather secondary
    question. The primary question is: what if the player types TAKE instead >>>>> of GET? And the answer is: an ABORT will be performed, ruining the game. >>>>>
    So yes, it is tempting to use Forth interpreter, which is already
    here, ready for use,
    but it's not quite prepared for gaming purposes.

    Determination beats reason every time. Infocom solved it 40 years ago. >>>>

    Other text game adventure systems are available; It might be fun, but it's >>> still wheel-reinventing.

    Indeed there are. What's bothering is the premise: 'Oh, but it should be
    possible to use the forth interpreter for that'. Suddenly it becomes about >> forth proving itself rather than identifying the needs of the application. >> I'm sure cute things can be done with the forth interpreter. I just question
    the priority.


    In my ciasdis assembler a mnemonic ( LEA, ) change the state of the
    system and the words understood/accepted are different.

    Forth assemblers are a cheap and effective use of the forth interpreter.
    They also come with many limitations and the user is warned it's easy to screw-up. In short, you get what you pay for.

    Like wise GET should switch to a wordlist which contains items like
    a SWORD and maybe items present in the location.

    If you start with
    1 CONSTANT SWORD
    you're on the wrong road.

    It is just that the most simple way is using the Forth interpreter.
    You can map the game syntax first, otherwise you don't know what
    you're doing.

    A great example is the BASIC interpreter that goes back to Chuck
    Moore (IIRC).

    His intention was to attract Forth users - not BASIC users :)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans Bezemer@21:1/5 to none albert on Tue Aug 16 09:16:17 2022
    On Tuesday, August 16, 2022 at 3:05:44 PM UTC+2, none albert wrote:
    But that's not the point here, I guess. It's not about the adventure, it's >about the voyage.
    About "can I do that". About learning. Not about "you've seen it all before".
    With all due respect, a game is only valuable, if it is worth playing.
    You should not embark on a game unless you have a great idea.
    (Except exercises.)
    See games.html on my site below.
    There are many reasons to do things. Their value is in the eye of the beholder. Your opinion - no matter how well founded - is only one of all possible (and even
    well grounded) opinions.

    Since "value" is derived from "goal", it finds its place in teleology - one of the more
    controversial branches of philosophy.

    Hans Bezemer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans Bezemer@21:1/5 to dxforth on Tue Aug 16 09:19:55 2022
    On Tuesday, August 16, 2022 at 10:22:59 AM UTC+2, dxforth wrote:
    FWIW here's a mostly working conversion to Standard Forth: https://pastebin.com/tR9gCP4E
    You're the second (or third) one converting it to Standard Forth. I did an attempt in
    the day (for one specific Forth) and Marcel Hendrix did one YEARS ago back in the
    20th century.

    Due to PC problems will need to leave it to others to iron out remaining issues.
    SwiftForth crashing was due to 'BL PARSE-WORD' in DECODE.
    Replace with: BL WORD COUNT
    BL PARSE-WORD is closely related to PARSE-NAME. It skips leading delimiters and is defined in 4tH as "OMIT PARSE". Since it's not standard, it's open to anyone to define
    it to their liking.

    Hans Bezemer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans Bezemer@21:1/5 to dxforth on Tue Aug 16 09:26:50 2022
    On Sunday, August 14, 2022 at 1:27:56 PM UTC+2, dxforth wrote:
    I had a quick look at venture.4th. While it uses the forth
    interpreter, AFAICS it does so very minimally - something
    that could be emulated without the quirks of forth?
    Not quite - because it can't. 4tH has NO interpreter, since it doesn't
    have a REPL. It either compiles or executes. It doesn't interpret while compiling and it can't compile while executing. Those are completely
    separate.

    But how do you stop the forth interpreter handling numbers :) Case-sensitivity, number handling etc IMO conspire to make it
    problematic for serious apps.
    4tH features a lib (interprt.4th) that can be configured by pragmas
    and callbacks. Disabling numbers is one of them. https://sourceforge.net/p/forth-4th/code/HEAD/tree/trunk/4th.src/lib/interprt.4th

    Hans Bezemer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans Bezemer@21:1/5 to none albert on Tue Aug 16 14:08:59 2022
    On Tuesday, August 16, 2022 at 3:05:44 PM UTC+2, none albert wrote:
    With all due respect, a game is only valuable, if it is worth playing.
    You should not embark on a game unless you have a great idea.
    Well, may be it is time to tell you where VENTURE.4tH came from. It started its life published as a "type-in" program for the Spectrum 16K in some Sinclair magazine in the '80-ies. So I typed it in, played it - and I thought it was neat.
    A handful of rooms, a few puzzles - and finally the great escape.

    When I created 4tH, in the late 1990ies, I wanted to add some "show case" programs - and this little game seemed like a nice candidate. So I figured out its structure and began coding it in the best readable Forth I could think of at
    the time. And even some 25 odd years later, I still think I didn't do too bad. https://sourceforge.net/p/forth-4th/code/HEAD/tree/trunk/4th.src/venture.4th

    It proved to be very easy to port in this form. So, I ported it to Arena, a C like
    scripting language I was contributing to at the time. Later I reported it to uBasic/4tH
    when that became a viable option. I even compared that implementation with the original - and man - it wasn't like it at all ;-) https://sourceforge.net/p/forth-4th/code/HEAD/tree/trunk/4th.src/apps/basic/venture.bas

    I've also ported it to a "simple adventure" script - with some minor changes. It's
    always been my "go to" program when I want to add some "real" application. For the reasons I just stated. It's got a great premise and although short, it's fun to
    play. https://sourceforge.net/p/forth-4th/code/HEAD/tree/trunk/4th.src/apps/simpladv/venture.chs

    So no - I don't think simple games have to be "full projects". Some games, although
    limited, are fun in their simplicity. I still play "Wallstreet" every now and then. Also
    a little game that catches your imagination - and is available in uBasic/4tH. https://sourceforge.net/p/forth-4th/code/HEAD/tree/trunk/4th.src/apps/basic/wallstrt.bas

    Hans Bezemer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From none) (albert@21:1/5 to dxforth@gmail.com on Tue Aug 16 23:18:39 2022
    In article <tdg8b0$18i6$1@gioia.aioe.org>, dxforth <dxforth@gmail.com> wrote: >On 16/08/2022 23:01, albert wrote:
    In article <td7a35$138s$1@gioia.aioe.org>, dxforth <dxforth@gmail.com> wrote:
    On 12/08/2022 18:44, Kerr-Mudd, John wrote:
    On Fri, 12 Aug 2022 12:02:19 +1000
    dxforth <dxforth@gmail.com> wrote:

    On 12/08/2022 00:32, Zbig wrote:
    It's much neater to do a table of course, but that's a bit harder. >>>>>>
    Maybe, but „the sword” — or, in general, the argument — is
    rather secondary
    question. The primary question is: what if the player types TAKE instead >>>>>> of GET? And the answer is: an ABORT will be performed, ruining the game. >>>>>>
    So yes, it is tempting to use Forth interpreter, which is already
    here, ready for use,
    but it's not quite prepared for gaming purposes.

    Determination beats reason every time. Infocom solved it 40 years ago. >>>>>

    Other text game adventure systems are available; It might be fun, but it's >>>> still wheel-reinventing.

    Indeed there are. What's bothering is the premise: 'Oh, but it should be >>> possible to use the forth interpreter for that'. Suddenly it becomes about >>> forth proving itself rather than identifying the needs of the application. >>> I'm sure cute things can be done with the forth interpreter. I just question
    the priority.


    In my ciasdis assembler a mnemonic ( LEA, ) change the state of the
    system and the words understood/accepted are different.

    Forth assemblers are a cheap and effective use of the forth interpreter.
    They also come with many limitations and the user is warned it's easy to >screw-up. In short, you get what you pay for.

    You can't "screw up" ciasdis. All errors are detected.
    In fact if you start with LEA, , you can ask for all possible continuations.


    Like wise GET should switch to a wordlist which contains items like
    a SWORD and maybe items present in the location.

    If you start with
    1 CONSTANT SWORD
    you're on the wrong road.

    It is just that the most simple way is using the Forth interpreter.
    You can map the game syntax first, otherwise you don't know what
    you're doing.

    A great example is the BASIC interpreter that goes back to Chuck
    Moore (IIRC).

    His intention was to attract Forth users - not BASIC users :)

    His intention was to write a great game, with more ease in
    Forth than in any other language, I guessed.
    If another language is more appropriate, use that.
    Case in point, see games.html in my site below.
    The tomato game is a so called "first person shooter" and it is written
    in C++. I couldn't have finished that in a couple of weeks in
    Forth.

    The reference to the interpreter serves to draw attention to
    techniques used there, not BASIC.

    Groetjes Albert
    --
    "in our communism country Viet Nam, people are forced to be
    alive and in the western country like US, people are free to
    die from Covid 19 lol" duc ha
    albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Hans Bezemer on Wed Aug 17 10:40:02 2022
    On 17/08/2022 02:26, Hans Bezemer wrote:
    On Sunday, August 14, 2022 at 1:27:56 PM UTC+2, dxforth wrote:
    I had a quick look at venture.4th. While it uses the forth
    interpreter, AFAICS it does so very minimally - something
    that could be emulated without the quirks of forth?

    Not quite - because it can't. 4tH has NO interpreter, since it doesn't
    have a REPL. It either compiles or executes. It doesn't interpret while compiling and it can't compile while executing. Those are completely separate.

    I see. OTOH it is using the WORD parser. That can be replaced as
    follows. In my case it saves 16 KB - the difference between keeping
    the forth compiler and discarding it.

    : split ( a u c -- a2 u2 a3 u3 )
    >r 2dup r> scan 2swap 2 pick - ;

    2variable input

    : token ( -- a u )
    input 2@ bl skip bl split 2swap input 2! ;

    : decode ( x -- a n x' f) token rot 2 string-key row ;

    ..

    : get-input ( -- u ) pad dup 32 accept tuck input 2! ;

    : command \ input a command
    cr ." Command: " get-input 0= abort" User abort" cr
    action
    ;

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to albert on Wed Aug 17 12:07:14 2022
    On 17/08/2022 07:18, albert wrote:
    ...
    A great example is the BASIC interpreter that goes back to Chuck
    Moore (IIRC).

    His intention was to attract Forth users - not BASIC users :)

    ...

    The reference to the interpreter serves to draw attention to
    techniques used there, not BASIC.

    When the result is a saleable product it will have the world's
    attention.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans Bezemer@21:1/5 to All on Wed Aug 17 03:12:42 2022
    On Wednesday, August 17, 2022 at 2:40:04 AM UTC+2, dxforth wrote:
    You're really twisting my arm here, but I can get it to run (partially)..

    include lib/pickroll.4th
    include lib/anscore.4th
    include lib/scanskip.4th
    include lib/row.4th

    hide split

    : split ( a u c -- a2 u2 a3 u3 )
    r 2dup r> scan 2swap 2 pick - ;

    2 array input2

    : token ( -- a u )
    input2 2@ bl skip bl split 2swap input2 2! ;

    : decode ( x -- a n x' f) token rot 2 string-key row ;


    : get-input ( -- u ) pad dup 32 accept tuck input2 2! ;

    : command \ input a command
    cr ." Command: " get-input 0= abort" User abort" cr
    ;

    begin
    command token type space token type
    again

    1. 2CONSTANT - I can get this to run, but I'll need the preprocessor for this one. But of an overkill if you ask me;
    2. SPLIT - is usually part of SCANSKIP.4tH - so I have to "forget" about this one when importing SCAN;
    3. INPUT - is a file modifier under 4tH (builtin), so a tiny name change is required. Can't forget a builtin word - or override it for that matter. You can only forget things in the symbol table;
    4. DECODE - compiles, but running it is for another day.

    Hans Bezemer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans Bezemer@21:1/5 to dxforth on Wed Aug 17 02:16:46 2022
    On Wednesday, August 17, 2022 at 2:40:04 AM UTC+2, dxforth wrote:
    On 17/08/2022 02:26, Hans Bezemer wrote:
    I see. OTOH it is using the WORD parser.
    Yes. At execution time, REFILL does just that - it reads a line
    from either a file or the terminal. But there it stops. It isn't processed automatically by a REPL. However, if you do PARSE (or: PARSE-WORD)
    it will show the addr/count of that string in the (unaltered) TIB (which
    it's got too). You can set your own TIB using SOURCE!

    That can be replaced as follows. In my case it saves 16 KB -
    the difference between keeping
    the forth compiler and discarding it.
    In 4tH you have a set runtime, which includes these words - so you
    won't save anything using your construct (although it might probably
    work in 4tH at first glance).

    To me, it's most often much handier to use PARSE/PARSE-WORD to
    do things since any stuff going through SCAN/SKIP means extra code
    (for 4tH).

    Hans Bezemer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans Bezemer@21:1/5 to none albert on Wed Aug 17 03:39:31 2022
    On Tuesday, August 16, 2022 at 3:05:44 PM UTC+2, none albert wrote:
    See games.html on my site below.
    One interesting quote down there:
    " The source is not published, because it was an assignment of the Socialistische Partij
    of the Netherlands as promotional material. They consider it a trade secret".

    Considering that Marx expresses the idea that information has a *negligible value* in the
    two following passages:
    "The product of mental labour—science—always stands far below its value, because the
    labour-time needed to reproduce it has no relation at all to the labour-time required for its
    original production. For example, a schoolboy can learn the binomial theorem in an hour.."

    “Once discovered, the law of the deflection of a magnetic needle in the field of an electric
    current, or the law of the magnetization of iron by electricity, cost absolutely nothing.”

    Remarkable point of view for a socialist party - considering that lots of IP generated by
    the government of the USA is free of IP rights, because "it was paid for by the taxpayers". ;-)

    Hans Bezemer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Hans Bezemer on Thu Aug 18 12:19:41 2022
    On 17/08/2022 20:12, Hans Bezemer wrote:
    On Wednesday, August 17, 2022 at 2:40:04 AM UTC+2, dxforth wrote:
    You're really twisting my arm here, but I can get it to run (partially)..

    include lib/pickroll.4th
    include lib/anscore.4th
    include lib/scanskip.4th
    include lib/row.4th

    hide split

    : split ( a u c -- a2 u2 a3 u3 )
    r 2dup r> scan 2swap 2 pick - ;

    2 array input2

    : token ( -- a u )
    input2 2@ bl skip bl split 2swap input2 2! ;

    : decode ( x -- a n x' f) token rot 2 string-key row ;


    : get-input ( -- u ) pad dup 32 accept tuck input2 2! ;

    : command \ input a command
    cr ." Command: " get-input 0= abort" User abort" cr
    ;

    begin
    command token type space token type
    again

    1. 2CONSTANT - I can get this to run, but I'll need the preprocessor for this one. But of an overkill if you ask me;
    2. SPLIT - is usually part of SCANSKIP.4tH - so I have to "forget" about this one when importing SCAN;
    3. INPUT - is a file modifier under 4tH (builtin), so a tiny name change is required. Can't forget a builtin word - or override it for that matter. You can only forget things in the symbol table;
    4. DECODE - compiles, but running it is for another day.

    What it tells me is that one needs to code for the forth one has. Getting
    the best out of each system is better - and more enjoyable - than forcing systems to conform to a single mindset.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans Bezemer@21:1/5 to dxforth on Thu Aug 18 23:43:58 2022
    On Thursday, August 18, 2022 at 4:19:46 AM UTC+2, dxforth wrote:
    What it tells me is that one needs to code for the forth one has. Getting
    the best out of each system is better - and more enjoyable - than forcing systems to conform to a single mindset.
    Of course you should. And I think most people do that - given the loads of "special extensions" most people have (and use - even when publishing code here).

    It's only annoying when you want to let that code run on your own compiler. Then you have to figure out what those extensions actually do. I did an interface for that purpose, although no guarantees that it'll run first time you
    slap it onto a random 4tH program. https://sourceforge.net/p/forth-4th/code/HEAD/tree/trunk/4th.src/lib/easy.4th

    On the other hand, if you want (or need) your program to run on other Forths every Forth compiler should be able IMHO to produce a version which is capable to run on other Forths with minimal effort.

    The stuff I produced for FSL were created with 4tH. And I've published several other routines here which ran (at least) on Gforth (that's my main ANS goto compiler).
    So, at least from my viewpoint and for all intents and purposes - 4tH works for me
    in that context. And I guess that's the sentiment of many here regarding their own
    implementation.

    The only problem I feel I encounter over and over again are COMUS words. Let's face
    it - almost EVERY Forth compiler supports them in one way or another. But hardcore
    purists always complain "it's not standard" (which is technically correct) and since
    they're not standardized their implementation (may) differ(s).

    So people are always doubting "should I define them or not"? (as you did in your
    code). Personally, I like conditional compilation (let the compiler figure it out), but
    others don't. Anyway, they're kind of standard, but actually they aren't - so it's a
    massive sh*tshow over and over again.

    I'd like to see a "COMUS" wordset to settle it once and for all. The purist may disavow
    the entire wordset if they prefer - nobody is obliged to include any wordset in their
    specific implementation - but at least we got that stumbling block out of the way.
    Leaving things in limbo simply doesn't work IMHO.

    And correct me if I'm wrong - but we're the only language having that problem. Never heard of "common C words" outside ANY standard, for example.

    Hans Bezemer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Hans Bezemer on Sat Aug 20 15:51:54 2022
    On 19/08/2022 16:43, Hans Bezemer wrote:
    ...
    The only problem I feel I encounter over and over again are COMUS words. Let's face
    it - almost EVERY Forth compiler supports them in one way or another. But hardcore
    purists always complain "it's not standard" (which is technically correct) and since
    they're not standardized their implementation (may) differ(s).

    So people are always doubting "should I define them or not"? (as you did in your
    code). Personally, I like conditional compilation (let the compiler figure it out), but
    others don't. Anyway, they're kind of standard, but actually they aren't - so it's a
    massive sh*tshow over and over again.

    I'd like to see a "COMUS" wordset to settle it once and for all. The purist may disavow
    the entire wordset if they prefer - nobody is obliged to include any wordset in their
    specific implementation - but at least we got that stumbling block out of the way.
    Leaving things in limbo simply doesn't work IMHO.

    And correct me if I'm wrong - but we're the only language having that problem.
    Never heard of "common C words" outside ANY standard, for example.

    ecvt fcvt etc are COMUS words in C. Informally defined, their behaviour and capability differs from one compiler to the next. In Forth, standards aren't top priority - more of a WIBNI. We're used to incompatibility between systems.

    My reasons for converting your adventure to more-or-less std forth were two-fold
    - it might be useful to the OP, and I needed it to run on a familiar system in order to experiment. Luckily the 4tH specific words were fully explained in the 4tH manual, along with their equivalent ANS behaviour. I had forgotten about Easy4th. Not that would it have helped in the case of :token

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to dxforth on Sat Aug 20 10:22:54 2022
    dxforth <dxforth@gmail.com> writes:
    ecvt fcvt etc are COMUS words in C. Informally defined,

    man ecvt says (on Debian 11):

    |CONFORMING TO
    | SVr2; marked as LEGACY in POSIX.1-2001. POSIX.1-2008 removes the spec‐
    | ifications of ecvt() and fcvt(), recommending the use of sprintf(3) in‐
    | stead (though snprintf(3) may be preferable).

    SVr2 is the Sytem V release 2 specification, so it was defined there,
    and up to POSIX.1-2001.

    So it's more formal than COMUS, and the intention is that they should
    not be commonly used in future code.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans Bezemer@21:1/5 to dxforth on Sun Aug 21 06:43:47 2022
    On Saturday, August 20, 2022 at 7:51:58 AM UTC+2, dxforth wrote:
    Luckily the 4tH specific words were fully explained in
    the 4tH manual, along with their equivalent ANS behaviour. I had forgotten about Easy4th. Not that would it have helped in the case of :token
    No, I'm sorry. After I'd really exhausted all ideas how to turn a (4tH) :NONAME into a (4tH) CONSTANT, I created :TOKEN - which turned to be very easy to define in 4tH, but extremely difficult in ANS. So yeah - that's a thing conditional
    compilation was designed to solve. If anyone's got any good ideas, I'm all for it.

    Hans Bezemer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans Bezemer@21:1/5 to Anton Ertl on Sun Aug 21 06:46:23 2022
    On Saturday, August 20, 2022 at 12:30:34 PM UTC+2, Anton Ertl wrote:
    So it's more formal than COMUS, and the intention is that they should
    not be commonly used in future code.
    The only way a standards committee is going to achieve that is by making
    it a formal wordset and then depricate it ;-)

    Hans Bezemer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Hans Bezemer on Mon Aug 22 16:18:49 2022
    On 21/08/2022 23:43, Hans Bezemer wrote:
    On Saturday, August 20, 2022 at 7:51:58 AM UTC+2, dxforth wrote:
    Luckily the 4tH specific words were fully explained in
    the 4tH manual, along with their equivalent ANS behaviour. I had forgotten >> about Easy4th. Not that would it have helped in the case of :token

    No, I'm sorry. After I'd really exhausted all ideas how to turn a (4tH) :NONAME
    into a (4tH) CONSTANT, I created :TOKEN - which turned to be very easy to define in 4tH, but extremely difficult in ANS. So yeah - that's a thing conditional
    compilation was designed to solve. If anyone's got any good ideas, I'm all for it.

    In computing, perhaps more than anywhere, is this notion things can/should
    be automated. I actually had fun finding out how to emulate :TOKEN - even
    if it was just looking up the manual where it was explained.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)