richpl / PyBasic

Simple interactive BASIC interpreter written in Python
GNU General Public License v3.0
165 stars 45 forks source link

Example adventure files #43

Closed RetiredWizard closed 2 years ago

RetiredWizard commented 2 years ago

When I was porting Adventure to PyDOS/PyBasic my big problems were memory and speed so in my efforts to get things running I hacked up the command parser. The command parser I ended up with was faster on the microcontroller but a lot less robust than the original version. This PR restores the orginal command parser which allows for command processor to deal with commands like "go to the east" or "take the bottle". The original parser also supported multiple commands on a single line "go east, go up, take all" or more usefully "throw axe, take axe" :).

While running through some testing for this PR I also stumbled on a bug I assume was in the Creative Computing port from the 70's. The issue comes up if the Dwarf shows up on the Troll bridge. In that case throwing the axe would result in the Troll catching it and there was no way to attack the Dwarf. I suppose I could have dug into the processing priority and had the axe fly toward the dwarf before anything else in the room, however it was easier (and more fun) to add a little interaction between the dwarf and the troll which resolves the problem. It also hints at the ultimate solution to the troll puzzle.

RetiredWizard commented 2 years ago

Almost forgot, I also moved the BITEMS data structure back into the program as DATA statements since pulling them out was an attempt to decrease running memory. I've regretted naming the file starting with the letter B instead of A like all the other data files so getting rid of it feels good.

I would also suggest, renaming the adventure-fast.bas file back to simply adventure.bas. I didn't do it in this pull request so that the changes I made to the program could be displayed through Github's comparison function.