-- Autogenerated with DRAKON Editor 1.31
#!/usr/bin/env python
# coding: utf-8

import sys



function baby_frog_Hungry_food(self, msg)
    -- item 20
    self.state = "Sleepy"
    return "yam-yam"
end

function baby_frog_Hungry_sleep(self, msg)
    -- item 29
    self.state = "Hungry"
    return "I am hungry"
end

function baby_frog_Sleepy_food(self, msg)
    -- item 31
    self.state = "Sleepy"
    return "na..."
end

function baby_frog_Sleepy_sleep(self, msg)
    -- item 35
    self.state = "Hungry"
    return "z-z-z..."
end

function main()
    -- item 10
    frog = baby_frog()
    -- item 11
    print("The baby frog says.")
    print(frog.state + "/sleep")
    print(frog.sleep())
    print(frog.state + "/food")
    print(frog.food())
    print(frog.state + "/food")
    print(frog.food())
    print(frog.state + "/sleep")
    print(frog.sleep())
end


function baby_frog()
    local obj = {}
    obj.type_name = "baby_frog"
    obj.state = "Hungry"
    obj.food = function(self, msg)
        local _state_ = self.state
        if _state_ == "Hungry" then
            return baby_frog_Hungry_food(self, msg)
        elseif _state_ == "Sleepy" then
            return baby_frog_Sleepy_food(self, msg)
        end
        return nil
    end
    obj.sleep = function(self, msg)
        local _state_ = self.state
        if _state_ == "Hungry" then
            return baby_frog_Hungry_sleep(self, msg)
        elseif _state_ == "Sleepy" then
            return baby_frog_Sleepy_sleep(self, msg)
        end
        return nil
    end
    return obj
end

main()
