Question
Need to code text-based game in Python-3 . Basically, it's intended to be monster-based -- I've sorted my theme and everything, but I made it
Need to code text-based game in Python-3. Basically, it's intended to be monster-based -- I've sorted my theme and everything, but I made it more simplistic on the map / dictionary.
Dictionary:
rooms = { 'Room 1' : { 'East' : 'Room 2', }, 'Room 2' : { 'North' : 'Room 3', 'South' : 'Room 7', 'East' : 'Room 5', 'West' : 'Room 1', 'item' : 'item 1' }, 'Room 3' : { 'East' : 'Room 4', 'item' : 'item 2' }, 'Room 4' : { 'West' : 'Room 3', 'item' : 'item 3' }, 'Room 5': { 'North': 'Room 6', 'West': 'Room 2', 'item': item 4}, 'Room 6' : { 'South' : 'Room 5', 'item' : 'item 5'}, 'Room 7' : {'North': 'Room 2', 'East' : 'Room 8, 'item': 'item 6' } }
The guidelines include developing functions using Python script, specifically to show different directional commands, identify room status, show inventory list, and display item in room. Likewise, a main function needs to be created. This game requires a continous loop until game is won or lost--developing calls to the functions created to show player's status and potential commands. I'll include an example of how I've been guiding myself (honestly just can't get anything to work regardless).
Sample Loop:
You are in the Bedroom Inventory: [] You see a Pillow ---------------------- Enter your move:
As the player collects items and moves between rooms, the status function should update accordingly. Here is another example after a player has collected items from two different rooms:
You are in the Master Bedroom Inventory: [Pillow] -------------- Enter your move:
And then sample output:
Congratulations! You have collected all items and won the pillow fight!.
If the player loses the game, they will see the following output:
SMACK! The pillow put you right to sleep. Start over?
Thanks for your help in advance.
East Room 4 Room 3 (item) (item) West North South Room 6 (item) East Room 1 (start) Room 2 (item) North South West East Room 5 (item) West North South East Room 7 Room 8 (item) (item) WestStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started