Closed brickbots closed 3 years ago
Looks good @brickbots !
When I first ported startrek, my version of PyBasic didn't have the ON-GOSUB working as it does now, so I replaced them with a bunch of IF statements. The original ON-GOSUB statements are still in the code as remarks, there's probably no reason not to un-remark them and delete the block of IFs.
In the ROCK_SCISSORS_PAPER.BAS demo, I added 1 to the results of the INSTR function, but your updates changes the value of the first position from 0 to 1 so that's no longer needed.
For compatibility it's probably better to have the TAB function in than not, but I believe the versions of BASIC I've encountered use the TAB function to place the print output location to the indicated column rather than moving the output location to the right the indicated number of spaces. I did get that functionality working but it was a bit messy especially since with the use of trailing semi-colons, multiple print statements could be outputting to a single output line. If you think the version of TAB I implemented is appropriate and you'd rather not work it into this PR, I could submit a PR for my version after this PR gets integrated.
Thanks so much @RetiredWizard for the review, great points all around!
Star Trek
I ended up removing a good number of REM statements from PyBStartrek.py as I was getting it working with this version of PyBasic, so it looks like I've lost this history of your changes there. I'm actually curious how far this has now drifted from the original code your started porting. Do you still have the version you started with or know where it can be found?
In any case, getting those ON-GOSUB's back is a good idea. Since there is a lot going on in this PR already and it technically works, I propose we merge this and I'll open a new issue to cleanup the included version of StarTrek. Then I'll either grab it again from your PyDOS repo and re-implement the on-gosubs, or if you still have the original source, see if we can use that as the base for a port. I'm hoping with our combined changes it should be pretty easy to port the original.
Rock, Scissors, Paper Good catch here, I played it but didn't pay close enough attention to spot that it was not properly registering my selections! I've updated this and pushed the changes to this branch.
TAB Yes, the column-tab behavior is preferable to the janky one I put in just to get old code running 💯 Let's get this PR merged and then you can submit a PR with your version which works properly!
Many thanks for this @brickbots, awesome job. I'll confess that the original development of the interpreter took me around six months and I was getting a bit obsessive and burnt out by the end. So I would not have summoned the will to move it on to this level of vintage BASIC compatibility!
Hey guys, you're both closer to the code than I am these days. The README contains the following two statements:
"Note that unlike some other BASIC variants, string positions start at 0."
"NOTE For compatibility with older basic dialetcs, all string indexes are 1 based."
Not sure which is the case any more!
Since there are so many example programs, if we do re-org the repo to modularize PyBasic, I suggest moving all the examples into their own directory.
I agree @brickbots, @RetiredWizard, so I've just tidied things up. Looks a lot cleaner, let me know if I've created any issues.
Thanks all, it's been a big team effort 🥇 I've put in a PR for the readme fix and found a couple other bits to tidy up while I was there.
The example folder is much cleaner and it seems to work fine when using quotes in the load command 👍
Building on the awesome work of @RetiredWizard here are some minor additional changes to improve compatibility with, and ease of porting, many vintage basic programs.
I've updated regression.bas, rock_scissors_paper.bas and factorial.bas to work with syntax changes.
PyBStartrek is now a fork of @RetiredWizard's pydos version with input/print delim update
Includes @RetiredWizard 's version of Adventure with minor input/print delim update
Includes bagel.bas as proof of portability. For most programs, the only updates are likely splitting single line loops!
Since there are so many example programs, if we do re-org the repo to modularize PyBasic, I suggest moving all the examples into their own directory.