Python Adventure game ============== For this project, your task is to continue the implementation of the adventure game

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Python Adventure game ============== For this project, your task is to continue the implementation of the adventure game

Post by answerhappygod »

Python
Adventure game
==============
For this project, your task is to continue the implementation of
the adventure game as shown in the starter code below.
The objective of this task is to create a single,
single-player interactive game using the Python console where
the user can:
- Explore at least 12 different rooms (these can be hard
hard-coded)
- Move between the rooms by s pecifying a compass
direction (N, E, S, W)
- Allow the user to pick up items
- Ask for directions to a particular room
- Search for items within any given set of rooms.
For each function in your code, you will need to state the
complexity of your solution, annotating this in big big-O
notation.
Appropriate comments and syntax should be used throughout your
code, as should object oriented styles.
Starter code is given
=====================
# Rooms have items, players can carry items
class Item:
def __init__(self, name='Unknown'):
self.name = name
# A player can enter a room from any of the compass
directions
class Room:
def __init__(self, name='Unknown', item = None, north =
None, east = None, south = None, west = None):
# Give each room a sensible name
self.name = name
# Setup other rooms the player can enter
self.north = north
self.east = east
self.south = south
self.west = west
# Represents the current player
class Player:
def __init__(self, name='Unknown'):
self.name = name
self.items = []
# Overall game code and logic
class Game:
def __init__(self, startRoom):
self.start = startRoom
def play(self, player):
self.player = player
# Add game play code here
# Setup the game board
r = Room("First room")
g = Game(r)
# Play as player
p = Player("Owain")
g.play(p)
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply