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 8203165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:27:22+00:00 2026-06-07T07:27:22+00:00

I am trying to make a simple game. The logic is like this: There

  • 0

I am trying to make a simple game.

The logic is like this: “There are five doors, each numbered 1 to 5. Users will be asked to input any one number. For example, if they enter “1”, the GoldRoom will be opened (and the associated class will be processed).”

Now, I have defined one class, GoldRoom(), and for testing, entered “1”. The processing happens as expected. However, when I enter “2” as my choice, the processing still happens, instead of the print statement, i.e the else statement is not getting executed.

Where am I going wrong?

#################################
#   Learning to make a game#
#################################

# An attempt to make a game
# Each room will be described by a class, whose base class will be Room
# The user will be prompted to enter a number, each number will be assigned with a Room in return

from sys import exit

print "Enter your choice:"
room_chosen = int(raw_input("> "))

if room_chosen == 1:
    goldroom = GoldRoom()
    goldroom.gold_room()


def dead(why):
    print "why, Good Job!"
    exit(0)

#class Room(object):  #the other room will be derived of this
#   pass

class Room(object):
    pass

class GoldRoom(Room):

    # here the user will be asked with question on how much Gold he wants

    print"This room is full of gold. How much do you take!"

    next = raw_input("> ")

    if "0" in next or "1" in next:
        how_much = int(next)
        print how_much
    else:
        dead("Man, learn to type some number")

    if how_much < 50:
        print "Nice, you are not greedy, you win!"
        exit(0)

    else:
        dead("You greedy bastard!")

#class KoiPondRoom(Room):

    # in this room, the user will be made to relax

#class Cthulhu_Room(Room):

    # sort of puzzle to get out

#class Bear_Room(Room):

    # bear room

#class Dark_Room(Room):

    # Dark Room, will  be turned into Zombie

#class Dead_Room(Room):

    # Those who enter here would be dead
if room_chosen == 1:
    goldroom = GoldRoom()
    goldroom.gold_room()
else:
    print "YOU SUCK!"
  • 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-07T07:27:26+00:00Added an answer on June 7, 2026 at 7:27 am

    the problem is here:

    class GoldRoom(Room):
    
        # here the user will be asked with question on how much Gold he wants
    
        print"This room is full of gold. How much do you take!"
    

    as the whole source loaded into python vm, this piece of code is executed, and it print some thing, you should change it to:

    class GoldRoom(Room):
    
        # here the user will be asked with question on how much Gold he wants
        def gold_room(self):
            print"This room is full of gold. How much do you take!"
    
            next = raw_input("> ")
    
            if "0" in next or "1" in next:
                how_much = int(next)
                print how_much
            else:
                dead("Man, learn to type some number")
    
            if how_much < 50:
                print "Nice, you are not greedy, you win!"
                exit(0)
    
            else:
                dead("You greedy bastard!")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to make a simple number clicker control for BlackBerry 6/7, like this: At
Trying to make a simple program to catalogue books. Something like this, for example:
I'm trying to make a simple browser game without relying on anything fancy like
I'm trying to make what is (essentially) a simple pool game, and would like
I'm trying to make a simple Tetris like game with Javascript and the html
Trying to make simple minesweeper game in python, but have one problem. I have
I am playing around with trying to make a simple Roguelike game to learn
I'm, trying to make a simple 3D game for Android, and I want to
I am trying to make a simple tile system for my game. I made
I've been trying to make a little simple game just to test my logics,

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.