• LOTTO with eFORTH

    From Marc Petremann@21:1/5 to All on Fri Mar 3 06:29:48 2023
    Good morning,
    Are you interested in the FORTH language?
    Looking for a real hands-on programming example?
    I invite you to discover my LOTTO project, written for eFORTH: https://github.com/MPETREMANN11/uEforth/blob/main/LOTTO.fs
    and:
    https://github.com/MPETREMANN11/uEforth/tree/main/lotto

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From NN@21:1/5 to Marc Petremann on Fri Mar 3 08:38:25 2023
    On Friday, 3 March 2023 at 14:29:50 UTC, Marc Petremann wrote:
    Good morning,
    Are you interested in the FORTH language?
    Looking for a real hands-on programming example?
    I invite you to discover my LOTTO project, written for eFORTH: https://github.com/MPETREMANN11/uEforth/blob/main/LOTTO.fs
    and:
    https://github.com/MPETREMANN11/uEforth/tree/main/lotto

    Hi Marc,

    The first line is draw 1610 and your last line is the first draw.
    Reading the code it wasn't clear you had the most recent first.

    One of the things I always found difficult was to do any deeper
    analysis using forth which was simpler in python.

    If you do decide to investigate in this direction, please post as I
    would be interested :)

    NN

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ice Black@21:1/5 to All on Fri Mar 3 13:13:24 2023
    On Friday, 3 March 2023 at 14:29:50 UTC, Marc Petremann wrote:
    Looking for a real hands-on programming example?

    Yeah, I've just disassembled uEf64 executable and inside text forth code, I've found the import of WaitForSingleObject API function. Nothing bad with it. The problem that I didn't find any other imports where the invokation of this API would be usefull.
    Could you please shed light in this - why do you import WaitForSingleObject?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marc Petremann@21:1/5 to All on Wed Mar 8 01:58:16 2023
    Le vendredi 3 mars 2023 à 15:29:50 UTC+1, Marc Petremann a écrit :
    Good morning,
    Are you interested in the FORTH language?
    Looking for a real hands-on programming example?
    I invite you to discover my LOTTO project, written for eFORTH: https://github.com/MPETREMANN11/uEforth/blob/main/LOTTO.fs
    and:
    https://github.com/MPETREMANN11/uEforth/tree/main/lotto

    Article in progress:
    https://eforth.arduino-forth.com/article/examples_lotto

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From NN@21:1/5 to All on Sun Mar 12 06:17:28 2023
    Hi Marc,

    I have never used structures. They feel very unforthy.
    However your example inspired me to give them a try.
    This one doesnt do much but its a start.


    begin-structure adraw
    field: nxt
    field: n
    field: n1
    field: n2
    field: n3
    field: n4
    field: n5
    field: L1
    field: L2
    end-structure

    0 value drawlist

    : add-draw ( n n1 n2 n3 n4 n5 n6 L1 L2 a -- a' )
    here >r
    adraw allot

    r@ l2 !
    r@ l1 !
    r@ n5 !
    r@ n4 !
    r@ n3 !
    r@ n2 !
    r@ n1 !
    r@ n !
    drawlist r@ nxt !
    r> to drawlist ;

    : show-draw ( a -- )
    cr ." ("
    >r
    r@ n @ 4 u.r space
    r@ n1 @ 2 u.r space
    r@ n2 @ 2 u.r space
    r@ n3 @ 2 u.r space
    r@ n5 @ 2 u.r space
    r@ n5 @ 2 u.r space
    r@ l1 @ 2 u.r space
    r@ l2 @ 2 u.r space

    r> drop
    ." ) " ;

    : showme ( a -- )
    drawlist >r
    begin r@ 0<> while
    r@ show-draw
    r> nxt @ >r
    repeat
    r> drop ;

    1600 3 6 13 40 42 7 11 Add-draw
    1601 11 27 41 43 47 7 11 Add-draw
    1602 8 9 15 19 31 10 12 Add-draw
    1603 7 12 19 33 43 3 7 Add-draw
    1604 2 14 17 32 45 3 10 Add-draw
    1605 2 8 34 44 47 3 9 Add-draw
    1606 3 13 25 36 47 3 8 Add-draw
    1607 24 26 38 43 46 2 3 Add-draw
    1608 8 23 27 42 45 1 9 Add-draw
    1609 21 22 34 41 49 2 7 Add-draw
    1610 7 23 34 42 48 1 3 Add-draw
    1611 12 29 33 37 47 5 10 Add-draw

    ( type showme prints out a list )

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marc Petremann@21:1/5 to All on Sun Mar 12 07:39:54 2023
    Le dimanche 12 mars 2023 à 14:17:30 UTC+1, NN a écrit :
    Hi Marc,

    I have never used structures.

    Structures are common in C language...

    I have write an article about structures in FORTH:

    https://eforth.arduino-forth.com/article/elements_dataStructures

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