+TheBF Posted March 6, 2019 Share Posted March 6, 2019 LOL. That's a good analysis. So you have put your finger on a proper partition. I should begin thinking about overview and you can be the detail guy. Where I have an idea on a detail you can evaluate if that's how you want to build it but we can leave those decisions to you. I was feeling a little ill last night so I didn't get much accomplished but I noticed the use of ON GOSUB in the game. Here is a fast Vector CASE statement that I saw in HsForth and is also used by others. I tried to make it work with FBForth quickly bit it didn't work with <BUILDS DOES>. Perhaps because DOES> is used outside the original colon definition. ? This might useful later after everything is working. However I did play the game for a while last night and I think the speedups in Forth and the freedom to go beyond arrays will make it work well. So my first overview request is let's: "make it work, then make it better" Steve Jobs. Meaning nothing to fancy out of the gate , just use Forth, create some meta words to handle the complexity and on we go. \ FAST vector table from HsForth, Jim Kalihan (RIP) \ no speed difference versus CASE OF ENDOF etc.. for 2 items \ improves greatly with long list of cases. : CASE: ( -- -7) CREATE ; : | ( <name> ) ' , ; : ;CASE ( n -- ) DOES> OVER + + @ EXECUTE ; \ !! no runtime error checking !! \ example code: \ : FOO ." FOO" ; \ : BAR ." BAR" ; \ : FIZZ ." FIZZ" ; \ : BUZZ ." BUZZ" ; \ CASE: CHOICE ( n -- ) | FOO | BAR | FIZZ | BUZZ ;CASE \ Usage: 3 CHOICE ( executes BUZZ) \ equivalent with Eaker CASE statement \ : TEST \ CASE \ 0 OF FOO ENDOF \ 1 OF BAR ENDOF \ 2 OF FIZZ ENDOF \ 3 OF BUZZ ENDOF \ ENDCASE ; Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.