# Philosphical Frog 
# H. Conrad Cunningham

#234567890123456789012345678901234567890123456789012345678901234567890

# 2018-09-17: Adapted from my extended 2010 Scala version

# This is an adaptation of the Philosphical Frog trait example from
# section 12.1 of the book _Programming in Scala_ by Martin Odersky, 
# Lex Spoon, and Bill Venners.

class Philosophical:
    def philosophize(self):
        return "I consume memory, therefore I am!"

class Pessimist:
    def philosophize(self):
        return "Vanity of vanities; all is vanity."
    
class Animal:
    def hello(self):
        return "Hello, I am a wild animal!"
    def __repr__(self):
        return "red"

class HasLegs:
    def walk(self):
        return "I can walk!"

class Frog1(Philosophical):
    def __repr__(self):
        return "green"

class Frog2(Philosophical,Animal):
    def __repr__(self):
        return "green"

class Frog3(Philosophical,Animal,HasLegs):
    def __repr__(self):
        return "green"

class Frog4(Philosophical,Animal,HasLegs,Pessimist):
    def __repr__(self):
        return "green"

class Frog5(Pessimist,Animal,HasLegs,Philosophical):
    def __repr__(self):
        return "green"


# Smoke testing code 

if __name__ == '__main__':
    print("PhilFrog program beginning now.")
    print("\nFrog1 subclassing Philosophical")
    frog1 = Frog1()
    print(f"frog1                = {frog1}")
    print(f"frog1.philosophize() = {frog1.philosophize()}")

    print("\nFrog2 subclassng Philosophical, Animal")
    frog2 = Frog2()
    print(f"frog2                = {frog2}")
    print(f"frog2.philosophize() + {frog2.philosophize()}")
    print(f"frog2.hello()        = {frog2.hello()}")

    print("\nFrog3 subclassing Philosophical, Animal, HasLegs")
    frog3 = Frog3()
    print(f"frog3                = {frog3}")
    print(f"frog3.philosophize() + {frog3.philosophize()}")
    print(f"frog3.hello()        = {frog3.hello()}")
    print(f"frog3.walk()         = {frog3.walk()}")

    print(f"\nFrog4 subclassing Philosophical, Animal, HasLegs, Pessimist")
    frog4 = Frog4()
    print(f"frog4                = {frog4}")
    print(f"frog4.philosophize() = {frog4.philosophize()}")
    print(f"frog4.hello()        = {frog4.hello()}")

    print(f"\nFrog5 subclassing Pessimist, Animal, HasLegs, Philosphical")
    frog5 = Frog5()
    print(f"frog5                 = {frog5}")
    print(f"frog5.philosophize()  = {frog5.philosophize()}")
    print(f"frog5.hello()         = {frog5.hello()}")

    print("\nPhilFrog program ending.")
