Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7920445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:13:23+00:00 2026-06-03T16:13:23+00:00

So, I have this problem I’m working on, and if someone could point me

  • 0

So, I have this problem I’m working on, and if someone could point me in the right direction, I’d be so grateful. Let me set it up for you.

I have 1 Python file/module named rooms filled with classes, like so:

class Intro(object):

    def __init__(self):
         # Setting up some variables here

    def description(self):
        print "Here is the description of the room you are in"

Which is all cool and stuff right? Then on another file/module, named Engine. I have this:

import rooms

class Engine(object):

    def __init__(self, first_class):
        self.lvl = first_class

    def play_it(self):
        next_lvl = self.lvl

        while True:
            # Get the class we're in & run its description
            next_lvl.description() # it works.
            # But how do I get the next class when this class is done?

See what I would like to happen is based on the user’s decision within each room/level class, the engine call upon a new class w/ its description function/attribute. Does that make sense? Or is there another way I should be thinking about this? Im ass-backwards sometimes. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T16:13:25+00:00Added an answer on June 3, 2026 at 4:13 pm

    Delegate the choice of which class to use next into the rooms. Eg

    class Intro(object):
    
        def __init__(self):
             # Setting up some variables here
    
        def description(self):
            print "Here is the description of the room you are in"
    
        def north(self):
            return Dungeon()
    
        def west(self):
            return Outside()
    
        #etc
    

    So when the player says “go west” in the Intro room, the Engine calls room.west() and the Intro room returns the Outside room.

    Hopefully that is enough of a hint! I expect you’ll want to make your own design.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this problem: ms-access could not delete and i found a potential solution
I have this problem decomposing a relation schema into a set of schemas that
I have this problem: I am choosing a file from JFileChooser and if i
I have this problem in my application: Step 1 - create an file (xml)
I have this problem. I read with BufferedReader text from one system file, this
I have this problem. I read with BufferedReader text from one system file, this
I have this problem I'm hoping someone knows the answer to. I have an
I have this problem: Thread1 may set an auto-reset event, and there are many
i have this problem: Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on
I have this problem. Any idea? from OpenGL.raw.GLUT import * File /usr/lib/python2.6/site-packages/OpenGL/raw/GLUT/__init__.py, line 6,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.