As well as the space invaders game mentioned in an earlier post I thought that I would also implement a textual adventure for the nostalgia value.
I sketched the map of the game on paper as shown below.
And then implemented the data structure in python.
# Room data indexes SHORT_DESC = 0 LONG_DESC = 1 N_EXIT = 2 S_EXIT = 3 E_EXIT = 4 W_EXIT = 5 U_EXIT = 6 D_EXIT = 7 OBJECT = 8 # Room Data rooms = [ ['dummy'], ['the entrance', 'the entrance to a rather large looking cave', 2, 0, 0, 0, 0, 0, ''], # 1 ['a corridor', 'a corridor that stretches off to the North', 3, 1, 0, 0, 0, 0, 'Lamp'], #2 ['a round room', 'a round room with many exits', 7, 2, 4, 0, 20, 6, ''], #3 ['a crawlway', 'a narrow east / west crawlway', 0, 0, 5, 3, 0, 0, ''], #4 ['a low cave', 'a low dead end cave', 0, 0, 0, 4, 0, 0, 'Knife'], #5 ['a well', 'a deep well with no way out', 0, 0, 0, 0, 0, 0, ''], #6 ['a crystal cave', 'a beautiful cave with crystal walls', 8, 3, 9, 0, 0, 0, ''], #7 ['an alcove', 'a small alcove in the cave wall', 0, 7, 0, 0, 0, 0, ''], #8 ['a passage', 'a long east / west passage', 0, 0, 10, 7, 0, 0, ''], #9 ['an anteroom', 'a richly decorated anteroom', 13, 11, 12, 9, 0, 0, ''], #10 ['a wardrobe', 'a large wardrobe with space for lots of clothes', 10, 0, 0, 0, 0, 0, 'Key'], #11 ['the throne room', 'a very large room with a golden throne on a dais', 0, 0, 0, 10, 0, 0, 'Crown'], #12 ['the view room', 'a cave with a small hole giving a view along a green valley', 0, 10, 14, 0, 0, 0, ''], #13 ['the guard room', 'a room with chairs and a table that looks like it was used as a guard room', 0, 0, 15, 13, 0, 0, ''], #14 ['the ballroom', ' a magnificent ballroom with purple and gold walls', 0, 17, 18, 14, 16, 0, ''], #15 ['the organ loft', 'a small room containing the controls for a large pipe organ', 0, 0, 0, 0, 0, 15, ''], #16 ['the vault', 'a small airtight vault with shelves around the sides', 15, 0, 0, 0, 0, 0, 'Bag of Money'], #17 ['the dining room', 'a long room with a huge dining table and chairs', 0, 0, 19, 15, 0, 0, ''], #18 ['the kitchen', 'a large dusty kitchen', 0, 0, 0, 18, 0, 0, ''], #19 ['a gallery', 'a high gallery leading off in a number of directions', 24, 22, 23, 21, 0, 0, ''], #20 ['the waterfall cave', 'a large cave with a dark lake and a waterfall at the far end', 0, 0, 20, 0, 0, 0, ''], #21 ['the echo cave', 'a small cave where sound echoes all around', 20, 0, 0, 0, 0, 0, ''], #22 ['the assassin room', 'a small room bare room', 0, 0, 25, 20, 0, 0, 'Masked Man'], #23 ['a dark cave', 'a dark cave', 24, 24, 20, 24, 24, 24, ''], #24 ['the exit', 'the exit of the cave', 0, 0, 0, 23, 0, 0, ''] #25 ] |
The game is now mostly working. Only the puzzles left to implement.