Show HN: Text adventure for CP/M – Lighthouse of Doom
github.com
github.com
https://news.ycombinator.com/item?id=26843660
Of course I immediately started working through some of the classic text-based adventure games (zork, hitchhiker's guide, etc), and that made me think I should write a game of my own.
This is very basic, with only four locations, and maybe 1/4 of the code is related to easter-eggs. Parenting means that Paw Patrol is a big deal, so there are some good references.
Anyway I had fun writing it.
I see 5 :)
Was one of my favorite projects - had to interface with a packet radio and a GPS receiver, along with various sensor attached to the controller's analog ports.
Now back to Java... :(
Interesting model, could you share how this worked out for you? Good and bad?
For example imagine you wrote an "EXAMINE" command, and you wanted to allow all objects to be examined. The horrid way to do it would be something like this:
if target == "desk"
print( "The desk is ..\n" );
if target == "book"
print( "The book is ..\n" );
With a table-based approach you just define your struct (in C) or item-table (in assembly) and your code now looks like this: item = find_item_by_name( object );
print( item.description );
Sure you have to write the lookup function to find the object, but it means you don't have to duplicate the logic for every action (get, drop, examine, use, etc).Using tables for items, and locations, basically saved me a lot of custom code, cut down on repetition.