By mattalui

So we decided to go from a number guessing game to an animal guessing game. We wanted it to be somewhat like 20 questions. The computer is supposed to guess the animal you are thinking of. We needed to figure out how the computer will know which animal you are thinking by the questions it asks. So we started working on classes and sub-classes.

We broke animals into two basic groups-vertebrate and invertebrate. Then we broke that into Mammels, fish, etc.

 

 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
50
51
'''Animal types.'''

class Animal:
    '''A Base Animal type.'''

class Vertebrate(Animal):
    '''An Animal with a backbone.'''

    def has_backbone(self):
    	return True

class Invertebrate(Animal):
    '''An Animal without a backbone.'''

    def has_backbone(self):
    	return False

class Fish(Vertebrate):
    '''A Vertebrate with no fur.'''

    def has_fur(self):
    	return False

class Mammal(Vertebrate):
    '''A Vertebrate with fur.'''

    def has_fur(self):
    	return True

class Human(Mammal):
    '''vertebrate with fur.'''

class Lion(Mammal):
    '''vertebrate with fur'''

class monkey(Mammal):
    '''vertebrate with fur'''

class jellyfish(invertebrate):
    '''not sure, but cool'''

class bear(Mammal):
    '''hairy monster!!!'''

class Matt(vertebrate):
    '''We're not sure exactly...'''

Leave a Reply