Esempio n. 1
0
from thieves import Thief

gimp = Thief(name='Omair', sneaky=False)
print(gimp)
print(gimp.sneaky)
print(gimp.agile)
print(gimp.hide(5))
Esempio n. 2
0
from thieves import Thief

allison = Thief(name="Allison", sneaky=False)

print(allison)
print(allison.sneaky)
print(allison.agile)
print(allison.hide(8))
Esempio n. 3
0
from thieves import Thief

pinecone = Thief(name="Mr. Pinecone")
print(pinecone.sneaky)
print(pinecone.agile)
print(pinecone.hide(6))
Esempio n. 4
0
from thieves import Thief

instance = Thief(name='Oskar', sneaky=False)
print(instance)
print(instance.sneaky)
print(instance.agile)
print(instance.hide(8))
Esempio n. 5
0
from thieves import Thief

kortney = Thief("kortney", sneaky=False)
print(kortney.sneaky)
print(kortney.agile)
print(kortney.hide(8))
Esempio n. 6
0
from thieves import Thief

tom = Thief(name="Tom", sneaky=False)
# name is now a keyword so that it is not simply positional in the init
print("{name} sneaky? {sneaky}".format(name=tom.name, sneaky=tom.sneaky))
print("{name} agile? {agile}".format(name=tom.name, agile=tom.agile))
print("{name} hide? {hide}".format(name=tom.name, hide=tom.hide(8)))

# john=Thief(sneaky=True)
# this will cause this exception
#   ValueError: 'name' is required
# from Character init

# inspect.getmro() or class.__mro__ can be used to a class's method
# resolution order (MRO)
print(Thief.__mro__)
# (<class 'thieves.Thief'>, <class 'attributes.Agile'>,
# <class 'attributes.Sneaky'>, <class 'characters.Character'>, <class 'object'>)

print(tom)  # running print on tom before the Character class was modified
# returns <thieves.Thief object at 0x00A8E1D0>
# after updating the Character class, when print is called on tom, it
# returns Thief: Tom
print(repr(tom))  # running this returns <thieves.Thief object at 0x00A8E1D0>
# which is what print(tom) did previously
# this can also be overridden with __repr__
Esempio n. 7
0

from thieves import Thief


ron = Thief(name = "ron", sneaky = False)


print(ron.sneaky)
print(ron.agile)
print(ron.hide(8))
Esempio n. 8
0
from thieves import Thief

viktor = Thief(name = "Viktor", sneaky=False)
print(viktor)
print(viktor.sneaky)
print(viktor.agile)
print(viktor.hide(8))
Esempio n. 9
0
from thieves import Thief

rock = Thief(name="rock", scar=None, weapon="wit")
jack = Thief("jack")
print(rock.agile)
print(rock.sneaky)
print(jack.hide(11))
Esempio n. 10
0
from thieves import Thief

kenneth = Thief(name="Kenneth", sneaky=False)
print(kenneth)
print(kenneth.sneaky)
print(kenneth.agile)
print(kenneth.hide(0))
Esempio n. 11
0
from thieves import Thief

ryan = Thief(name="Ryan", sneaky=False)
print(ryan)
print(ryan.sneaky)
print(ryan.agile)
print(ryan.hide(8))
Esempio n. 12
0
"""Quick test for character attributes"""

from thieves import Thief

george = Thief(name="George", sneaky=False)
print(george)
print(george.sneaky)
print(george.agile)
print(george.hide(8))
Esempio n. 13
0
from thieves import Thief

joel = Thief(name="Joel", sneaky=False)
print(joel.sneaky)
print(joel.agile)
print(joel.hide(8))
Esempio n. 14
0
from thieves import Thief

sean = Thief(name="Sean", sneaky=False)
print(sean.sneaky)
print(sean.agile)
print(sean.hide(8))
Esempio n. 15
0
from thieves import Thief

kenneth = Thief(name='Kenneth', sneaky=False)
print(kenneth)
print(kenneth.sneaky)
print(kenneth.agile)
print(kenneth.hide(9))
Esempio n. 16
0
from thieves import Thief

casey = Thief(name="Casey", sneaky=False)
print(casey)
print(casey.sneaky)
print(casey.agile)
print(casey.hide(8))
Esempio n. 17
0
from thieves import Thief

jimmy = Thief(name="Jimmy", sneaky=False)
print(jimmy.sneaky)
print(jimmy.agile)
print(jimmy.hide(8))
Esempio n. 18
0
from thieves import Thief
from inventory import Inventory
from items import Item
from items import Weapon

charles = Thief(name="Charles", sneaky=False)
print(charles.sneaky)
print(charles.agile)
print(charles.hide(8))
print("\n\n")
print("Printing Class and Instance information using __str__.")
print(charles)

# instantiate an Item object
coin = Item('coin', 'a gold coin')

# instantiate an Inventory object
inventory = Inventory()
inventory.add(coin)

print("You have {} item(s) in your inventory.".format(len(inventory)))
if coin in inventory:
    print("You have a gold coin in your inventory.")

sword = Weapon('sword', '2h sharp sword', 50)
inventory = Inventory()
inventory.add(sword)
for item in inventory:
    print("Item Name: {} - Item Description: {}".format(
        item.name, item.description))
Esempio n. 19
0
from thieves import Thief

taylor = Thief(name="taylor", sneaky=False)

print(taylor)
print(taylor.sneaky)
print(taylor.agile)
print(taylor.hide(12))
Esempio n. 20
0
from thieves import Thief

josh = Thief("Josh", sneaky=False)
print(josh.sneaky)
print(josh.agile)
print(josh.hide(8))
Esempio n. 21
0
from thieves import Thief

daesy = Thief(name="Daesy", sneaky=False)
print(daesy)
print(daesy.sneaky)
print(daesy.agile)
print(daesy.hide(8))
Esempio n. 22
0
from thieves import Thief

sepehr = Thief(name='sepehr', sneaky=False)

print(sepehr.sneaky)
print(sepehr.agile)
print(sepehr.hide(8))
Esempio n. 23
0
from thieves import Thief

jonnie = Thief(name="Jonnie", sneaky=False)

print(jonnie.sneaky)
print(jonnie.agile)
print(jonnie.hide(8))
Esempio n. 24
0
from thieves import Thief

matt = Thief(name="Matt", sneaky=False)
print(matt)
print(matt.sneaky)
print(matt.agile)
print(matt.hide(8))
Esempio n. 25
0
from thieves import Thief

kevin = Thief(name="Kevin", sneaky=False)
print(kevin.sneaky)
print(kevin.agile)
print(kevin.hide(8))
Esempio n. 26
0
from thieves import Thief

kenneth = Thief(name="Kenneth", sneaky=False)
print(kenneth.sneaky)
print(kenneth.agile)
print(kenneth.hide(8))

# isinstance('a', str)   -> True
# isinstance(5.2, (str, bool, dict))    -> False

# issubclass(bool, int)    -> True
# issubclass(str, int)    -> False
# issubclass(Thief, Character)    -> True

type(kenneth)       # returns <class 'thieves.Thief'>
kenneth.__class__       # returns <class 'thieves.Thief'>
kenneth.__class__.__name__      # returns 'Thief'
from thieves import Thief

anthony = Thief(name="Anthony", sneaky=False)
print(anthony)
print(anthony.sneaky)
print(anthony.agile)
print(anthony.hide(8))
Esempio n. 28
0
from thieves import Thief

prabhakar = Thief(name='Prabhakar', sneaky=True)
print(prabhakar.sneaky)
print(prabhakar.agile)
print(prabhakar.hide(8))
Esempio n. 29
0
from thieves import Thief

devin = Thief(name="Devin", sneaky=False)
print(devin)
print(devin.sneaky)
print(devin.agile)
print(devin.hide(8))