-
Notifications
You must be signed in to change notification settings - Fork 0
/
figuring_out_classes.py
49 lines (41 loc) · 1.54 KB
/
figuring_out_classes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
"""solving class inhertance questions I've had. Practicing via
RPG character sheet model of Classes"""
import random
class CharacterSheet:
def __init__(self, name):
self.name = name
self.cha = 0
self.intl = 0
self.strg = 0
self.make_me = self.creat_char( name )
self.send = self.send()
def __repr__(self):
return ( "{} has been created, with {} Charisma, {} Intelligence, {} Strength, and {} HP".format( self.name,
self.cha,
self.intl,
self.strg, self.hp ) )
# def __repr__(self):
# return poop
def creat_char(self, name):
self.name = name
self.cha = random.randrange( 1, 20 )
self.intl = random.randrange( 1, 20 )
self.strg = random.randrange( 1, 20 )
self.hp = random.randrange( 1,30)
def send(self):
gameMaster.char_box.append( self )
print( gameMaster.char_box )
return gameMaster.char_box
class Table:
def __init__(self):
self.char_box = []
self.char_folder = {}
#
# def __repr__(self):
# return ( [].format(gameMaster.char_box) )
gameMaster = Table()
Dingo = CharacterSheet( "Dingo" )
Spanker = CharacterSheet("Spanker")
Spanker.intl=29
print(Spanker)
print(gameMaster.char_box)