Build a Text Adventure game using Python. Assignment Details A Text Adventure is an older style of game popular on computers before Graphical User Interfaces were common (and sometime after then,...

1 answer below »

Build a Text Adventure game using Python.




Assignment Details


A Text Adventure is an older style of game popular on computers before Graphical User Interfaces were common (and sometime after then, too). The player is provided with a description of where they are, and a list of options on what they can do next. The player can then type their next action, at which point the computer will describe what happens and what the player can do next.


Build your own text adventure using whatever theme and subject you like. You'll need to build a system for getting user input and describing what happens next. You'll also need to keep track of some state, such as items and what rooms are currently open to the player. You also need to implement a save/load system, so players can save their games and come back to it after exiting the program.



Full Requirements:



  • Game must include at least 6 different "rooms" the player can explore

  • Game must include at least two items that must be collected to beat the game

  • Game must include at least one text entry "puzzle":

    • On interacting with an item, the player is asked to type in a number, name or answer to a riddle

    • If the player inputs the correct response, they either receive an item or are allowed into a new room

    • If the player inputs an incorrect response, they exit the prompt and must interact with the item again to try again

    • If the player inputs an incorrect response, it must be obvious to the player that they entered the wrong answer



  • Game must include a save/load feature:

    • Aside from navigating the rooms, the player should have the option to save or load their game

    • Saving the game should store relevant game information as plain text in a text file in the same location as the .py script (or a binary file using Pickle)

    • Loading the game should reset all items and game state to what was stored in the text file

    • If the player attempts to load a game when a save file doesn't exist, the game should handle it gracefully and not crash



  • The game must be winnable

  • The game must gracefully handle incorrect input

  • Your code should be well commented to describe the following:

    • What each variable/function/class does

    • How the game works





Suggestions:



  • Work on the more complicated features (such as the basic menu system, save/load and items) before the simpler ones (such as room descriptions)

  • Provide hints for your puzzles and items in each room

  • Your player can navigate the rooms in multiple ways. Each room could have a "go north, south, east or west" command, or you can provide a numbered list of available locations, allowing the player to move to that location by entering the correct number.

Answered Same DayApr 23, 2021

Answer To: Build a Text Adventure game using Python. Assignment Details A Text Adventure is an older style of...

Pushpendra answered on Apr 24 2021
149 Votes
import pickle
import random # For the random number
import os
import json
def initialize(): # initialization function for how to play
print("Number of rooms: 6(1,2,3,4,5,6)")
print("Each room contains 5 numbers(different or same)")
print("Initial or current position is 0 and your score is also 0")
print("If you move to the higher number room then you lose your score by difference of room's number")
print("If you move to the lower number room then you gain your score by difference of room's number")
print("After you enter in any room choose any number that are present in that room and your score is increase by that number")
num=random.randint(2,6)
print("Move to all 6 room in such way so that your score is divisible by {}".format(num))
print("If you visit any room twice or your score is not divisible by {} then you will not win the game otherwise you will win the match".format(num))
print("when your score is negative at any time then you will lose the game")
return num
def init_room(): # Inialize 6 room with 3 random number
room={}
room[1]=[]
room[2]=[]
room[3]=[]
room[4]=[]
room[5]=[]
room[6]=[]
for i in range(1,7):
for j in range(3):
room[i].append(random.randint(1,10)) # Choosing 3 random number for all rooms
return room
model={}
def new_game(): # To play a new...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here