Beispiel #1
0
 def test_house_size(self):
   myhouse= house.House(roomcount=48,floorcount=2)
   self.assertEqual(len(myhouse.rooms),12)
   self.assertEqual(len(myhouse.rooms[0]),8)
   del myhouse
   myhouse = house.House()  
   self.assertEqual(len(myhouse.rooms),10)
   self.assertEqual(len(myhouse.rooms[0]),5)
   del myhouse
    def __init__(self, width, height):
        self.width = width
        self.height = height

        self.sky = rect.Rect(0, 0, width, height, (20, 235, 250))
        self.grass = rect.Rect(0, 640, width, 320, (120, 190, 50))
        self.mountain1 = mountain.Mountain(200, 80, 640, 640, (50, 60, 160))
        self.mountain2 = mountain.Mountain(400, 120, 500, 640, (5, 15, 120))
        self.house = house.House(800, 540, 100, 100)
        self.house2 = house.House(850, 540, 150, 150)
    def constructStage(self):
        # set the width of the platform blocks. BlockHeight is the same, so I just left it as one variable
        BLOCK_WIDTH = 20

        #easy way to see numner of blocks that make up x and y
        blocknumX = self.width / BLOCK_WIDTH
        blocknumY = self.height / BLOCK_WIDTH

        # creates the Group of platform Sprites. Group is like a list of Sprites
        self.platformGroup = pygame.sprite.Group()

        constructor = levelBuild.Construct()
        newGrid = constructor.grid

        self.home = house.House((400, 25), 'house.png')
        self.homeGroup = pygame.sprite.Group()
        self.homeGroup.add(self.home)

        for y in xrange(len(newGrid)):
            for x in xrange(len(newGrid[y])):
                if newGrid[y][x] == 1:
                    tempPlat = levelBuild.Platform(
                        (x * BLOCK_WIDTH, y * BLOCK_WIDTH), BLOCK_WIDTH,
                        BLOCK_WIDTH)
                    self.platformGroup.add(tempPlat)
Beispiel #4
0
def Neighborhood():
                houses  = random.randint(5,7)
                neigh =  []
                for x in range (houses):

                        loc  = house.House()
                        neigh.append(loc)

                return neigh
Beispiel #5
0
def read_houses(lst):
    houses = []
    for h in lst:
        t = house.House(MLS=h['MLS'],
                        Price=util.format_number(h['Asking Price']),
                        Taxes=util.format_number(h['Yearly Taxes']),
                        HOA=util.format_number(h['HOA (Monthly)']),
                        Address=h['Address'])
        houses.append(t)
    return houses
Beispiel #6
0
 def __init__(self, width, height):
     self.mWidth = width
     self.mHeight = height
     self.mBlueSky = sky.Sky(self.mWidth, self.mHeight)
     self.mGround = ground.Ground(self.mWidth, self.mHeight)
     self.mMountain = mountain.Mountain(self.mWidth, self.mHeight)
     self.mMoon = moon.Moon(self.mWidth, self.mHeight)
     self.mWater = water.Water(self.mWidth, self.mHeight)
     self.mHouse = house.House(self.mWidth, self.mHeight)
     self.mCloud = cloud.Cloud(self.mWidth, self.mHeight)
     self.mBird = bird.Bird(self.mWidth, self.mHeight)
Beispiel #7
0
def parse_house(xmlstr):
    x = xmlparse.parseString(xmlstr)
    try:
        mlsnum = getnodetext(x.getElementsByTagName('MLSNumber')[0])
        price = getnodetext(x.getElementsByTagName('Price')[0])
        status = getnodetext(x.getElementsByTagName('ListingStatus')[0])
    except:
        raise

    try:
        taxes = getnodetext(x.getElementsByTagName('Taxes')[0])
    except:
        taxes = None
    try:
        addr = x.getElementsByTagName('Address')[0]
        city = x.getElementsByTagName('City')[0]
        state = x.getElementsByTagName('State')[0]
        zip = x.getElementsByTagName('Zip')[0]
        address = '{0}, {1}, {2}  {3}'.format(getnodetext(addr),
                                              getnodetext(city),
                                              getnodetext(state),
                                              getnodetext(zip))
    except:
        address = None
    try:
        nodes = x.getElementsByTagName(
            'MainFeature')  # Find the 'Rental Price' name element
        hoa = "0"
        for n in nodes:
            # RE/MAX stores the HOA in an element called 'Fees' but doesn't specify
            # whether it's annually, monthly, ...
            if n.getAttribute("Name") == "Fees":
                hoa = n.getAttribute("Value")
    except:
        pass

    h = house.House(MLS=mlsnum,
                    Price=util.format_number(price),
                    Address=address,
                    HOA=util.format_number(hoa),
                    Status=status,
                    Taxes=util.format_number(taxes))

    return h
Beispiel #8
0
def city_handler(self, event):
    """event handler of city"""
    #moves between menu items

    if event.type == KEYDOWN and event.key == K_UP:  #moves the cursor up
        self.cursor_se.play()
        self.city.menu -= 1
        if self.city.menu < 0:
            self.city.menu = MENU_MAX
        if self.city.menu == 2 and self.party.house == 0:
            self.city.menu -= 1

    elif event.type == KEYDOWN and event.key == K_DOWN:
        self.cursor_se.play()
        self.city.menu += 1
        if self.city.menu > MENU_MAX:
            self.city.menu = 0
        if self.city.menu == 2 and self.party.house == 0:
            self.city.menu += 1

    #move to each menu item
    if event.type == KEYDOWN and (event.key == K_SPACE or event.key == K_z
                                  or event.key == K_RETURN):

        self.select_se.play()

        self.city.music = 0

        if self.city.menu == City.BAR:
            self.game_state = BAR
            self.city = None
            self.bar = bar.Bar()
        elif self.city.menu == City.INN:
            self.game_state = INN
            self.city = None
            self.inn = inn.Inn()
        elif self.city.menu == City.HOUSE:
            self.game_state = HOUSE
            self.city = None
            self.house = house.House()
        elif self.city.menu == City.SHOP:
            if len(self.party.member) == 0:
                #if it cannot be selected, continue music
                self.city.music = 1
            else:
                self.game_state = SHOP
                self.city = None
                self.shop = shop.Shop(self)
        elif self.city.menu == City.TEMPLE:
            if len(self.party.member) == 0:
                self.city.music = 1
            else:
                self.game_state = TEMPLE
                self.city = None
                self.temple = temple.Temple()
        elif self.city.menu == City.CASTLE:
            self.game_state = CASTLE
            self.city = None
            self.castle = castle.Castle()
        elif self.city.menu == City.TOWER:

            self.game_state = TOWER
            self.city = None
            self.tower = tower.Tower()

    elif event.type == KEYDOWN and event.key == K_x:

        self.game_state = MENU
        self.city = None
        self.menu = menu.Menu()
import vtk
import random
import house as h
import arbol as abl
import sol

# source
## Arbol
### Tronco y Hojas
tree = abl.Tree()

## Casa
house = h.House()

## Sol
sun = sol.Sun()

# mapper
## Arbol
### Tronco
mapperTrunk = tree.SetTrunk(0.3, 2.6, 50)  #radio,height,resolution

### Hojas
mapperLeaf = tree.SetLeaf(0.3, 500)  #radio,resolution

## Casa
mapperChapa = house.SetSphere(0.1)  #radio
mapperCone = house.SetCone(1.9, 1.6, 50)  #radio,height,resolution
mapperCube1 = house.SetCube(2.5, 2.5, 2.5)  #cuerpo
mapperCube2 = house.SetCube(1.2, 1.8, 0.2)  #puerta
mapperCube3 = house.SetCube(0.1, 1.1, 1.4)  #ventana
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#åäö i kommentarer^
import house
import room
import character
import things

#The house
my_house = house.House()

#Characters
player = character.Character("Murneh", my_house.hallway)
player2 = character.Character(
    "Elin", my_house.hallway)  #kan den här också heta player?
rat1 = character.Character("Rat", my_house.cellar)

#Items
muddy_shoes = things.Things("Muddy Shoes", "mud", my_house.hallway)
leather_shoes = things.Things("Nice leather shoes", "leather",
                              my_house.hallway)
knitted_hat = things.Things("Green knitted hat", "sweat", my_house.hallway)
trenchcoat = things.Things("Trenchcoat", "musk", my_house.hallway)
cigarettes = things.Things("A pack of cigarettes", "tobacco", trenchcoat)
matchbox = things.Things("Matchbox", "sulfur", trenchcoat)
magical_map = things.Things("Magical Map", "Wonderful", my_house.hallway)

old_books = things.Things("Alot of old books", "old books", my_house.library)
mysterious_diary = things.Things("Mysterious Diary", "old book",
                                 my_house.library)
perfume_bottle = things.Things("Luxurious Perfume", "",
Beispiel #11
0
 def setup():
     self.deck = deck.Deck()
     self.player = player.Player(self.deck)
     self.house = house.House(self.deck)