👨‍💻 dev AXskillBundle

development

fukurou

the supreme coder
ADMIN
vb.net:
Code:
        Public Sub openGateforNSeconds(ByVal n As Integer)
            ' The gate will stay open for n seconds.
            Me.openedGate = Me.openedGate.AddSeconds(n)
        End Sub
 

fukurou

the supreme coder
ADMIN
Code:
Public Class DiBicameral
    Inherits DiSkillV2
    ' DiBicameral bicameral = New DiBicameral()
    ' bicameral.msgCol.addMSGV2("02:57", "test run ok")
    ' Add # for messages that engage other skills

    Public msgCol As New TimedMessages()

    Public Overrides Sub input(ByVal ear As String, ByVal skin As String, ByVal eye As String)
        msgCol.tick()

        If Not kokoro.toHeart.GetOrDefault("dibicameral", "null").Equals("null") Then
            kokoro.toHeart("dibicameral") = "null"
        End If

        If msgCol.getMsg() Then
            Dim temp As String = msgCol.getLastMSG()
            If Not temp.Contains("#") Then
                setSimpleAlg(temp)
            Else
                kokoro.toHeart("dibicameral") = temp.Replace("#", "")
            End If
        End If
    End Sub
End Class
 

fukurou

the supreme coder
ADMIN
vb.net:
Code:
    Public Class DiBicameral
        Inherits DiSkillV2
        ' DiBicameral bicameral = New DiBicameral()
        ' bicameral.msgCol.addMSGV2("02:57", "test run ok")
        ' Add # for messages that engage other skills

        Public msgCol As New TimedMessages()

        Public Overrides Sub input(ByVal ear As String, ByVal skin As String, ByVal eye As String)
            msgCol.Tick()

            If Not kokoro.toHeart("dibicameral").Equals("null") Then
                kokoro.toHeart("dibicameral") = "null"
            End If

            If msgCol.GetMsg() Then
                Dim temp As String = msgCol.GetLastMSG()
                If Not temp.Contains("#") Then
                    SetSimpleAlg(temp)
                Else
                    kokoro.toHeart("dibicameral") = temp.Replace("#", "")
                End If
            End If
        End Sub
        Public Overrides Sub SetKokoro(kokoro As Kokoro)
            MyBase.SetKokoro(kokoro)
            kokoro.toHeart("dibicameral") = "null"
        End Sub
    End Class
 

fukurou

the supreme coder
ADMIN
Swift:
class AXSkillBundle {
    private var skills: [DiSkillV2] = []
    private let tempN = Neuron()
    private var kokoro = Kokoro(absDictionaryDB: AbsDictionaryDB())

    func setKokoro(_ kokoro: Kokoro) {
        self.kokoro = kokoro
        for skill in skills {
            skill.setKokoro(kokoro: self.kokoro)
        }
    }

    init(skillsParams: DiSkillV2...) {
        for skill in skillsParams {
            skill.setKokoro(kokoro: self.kokoro)
            skills.append(skill)
        }
    }

    @discardableResult
    func addSkill(_ skill: DiSkillV2) -> AXSkillBundle {
        // builder pattern
        skill.setKokoro(kokoro: self.kokoro)
        skills.append(skill)
        return self
    }

    func dispenseAlgorithm(ear: String, skin: String, eye: String) -> AlgorithmV2? {
        for skill in skills {
            skill.input(ear: ear, skin: skin, eye: eye)
            skill.output(noiron: tempN)
            for j in 1..<6 {
                if let temp = tempN.getAlg(defcon: j) {
                    return AlgorithmV2(priority: j, alg: temp)
                }
            }
        }
        return nil
    }

    func getSize() -> Int {
        return skills.count
    }
}
 

fukurou

the supreme coder
ADMIN
Swift:
class DiSkillBundle: DiSkillV2 {
    private let axSkillBundle = AXSkillBundle()

    override func input(ear: String, skin: String, eye: String) {
        if let a1 = axSkillBundle.dispenseAlgorithm(ear: ear, skin: skin, eye: eye) {
            self.outAlg = a1.getAlg()
            self.outpAlgPriority = a1.getPriority()
        }
    }

    override func setKokoro(kokoro: Kokoro) {
        super.setKokoro(kokoro: kokoro)
        axSkillBundle.setKokoro(kokoro)
    }

    func addSkill(_ skill: DiSkillV2) {
        axSkillBundle.addSkill(skill)
    }
}
 

fukurou

the supreme coder
ADMIN
vb.net
Code:
    Public Class AlgorithmV2
        Private priority As Integer = 4
        Private alg As Algorithm = Nothing

        Public Sub New(ByVal priority As Integer, ByVal alg As Algorithm)
            Me.priority = priority
            Me.alg = alg
        End Sub

        Public Function GetPriority() As Integer
            Return priority
        End Function

        Public Sub SetPriority(ByVal priority As Integer)
            Me.priority = priority
        End Sub

        Public Function GetAlg() As Algorithm
            Return alg
        End Function

        Public Sub SetAlg(ByVal alg As Algorithm)
            Me.alg = alg
        End Sub
    End Class
    Public Class AXSkillBundle
        Private skills As New List(Of DiSkillV2)()
        Private tempN As New Neuron()
        Private kokoro As New Kokoro(New AbsDictionaryDB())

        Public Sub SetKokoro(ByVal kokoro As Kokoro)
            Me.kokoro = kokoro
            For Each skill As DiSkillV2 In skills
                skill.SetKokoro(Me.kokoro)
            Next
        End Sub

        Public Sub New(ParamArray skillsParams As DiSkillV2())
            For Each skill As DiSkillV2 In skillsParams
                skill.SetKokoro(Me.kokoro)
                skills.Add(skill)
            Next
        End Sub

        Public Function AddSkill(ByVal skill As DiSkillV2) As AXSkillBundle
            ' Builder pattern
            skill.SetKokoro(Me.kokoro)
            skills.Add(skill)
            Return Me
        End Function

        Public Function DispenseAlgorithm(ByVal ear As String, ByVal skin As String, ByVal eye As String) As AlgorithmV2
            For Each skill As DiSkillV2 In skills
                skill.Input(ear, skin, eye)
                skill.Output(tempN)
                For j As Integer = 1 To 5
                    Dim temp As Algorithm = tempN.GetAlg(j)
                    If temp IsNot Nothing Then
                        Return New AlgorithmV2(j, temp)
                    End If
                Next
            Next
            Return Nothing
        End Function

        Public Function GetSize() As Integer
            Return skills.Count
        End Function
    End Class
 

fukurou

the supreme coder
ADMIN
Code:
    Public Class DiSkillBundle
        Inherits DiSkillV2

        Private ReadOnly axSkillBundle As New AXSkillBundle()

        Public Overrides Sub Input(ByVal ear As String, ByVal skin As String, ByVal eye As String)
            Dim a1 As AlgorithmV2 = axSkillBundle.DispenseAlgorithm(ear, skin, eye)
            If a1 Is Nothing Then
                Return
            End If
            Me.outAlg = a1.GetAlg()
            Me.outpAlgPriority = a1.GetPriority()
        End Sub

        Public Overrides Sub SetKokoro(ByVal kokoro As Kokoro)
            MyBase.SetKokoro(kokoro)
            axSkillBundle.SetKokoro(kokoro)
        End Sub

        Public Sub AddSkill(ByVal skill As DiSkillV2)
            axSkillBundle.AddSkill(skill)
        End Sub
    End Class
 

fukurou

the supreme coder
ADMIN
Swift:
class SkillHubAlgDispenser {
    // Super class to output an algorithm out of a selection of skills
    // Engage the hub with dispenseAlg and return the value to outAlg attribute
    // of the containing skill (which houses the skill hub)
    // This module enables using a selection of 1 skill for triggers instead of having the triggers engage on multiple skills
    // The method is ideal for learnability and behavioral modifications
    // Use a learnability auxiliary module as a condition to run an active skill shuffle or change method
    // (rndAlg, cycleAlg)
    // Moods can be used for specific cases to change behavior of the AGI, for example low energy state
    // For that use (moodAlg)
   
    private var skills: [DiSkillV2] = []
    private var activeSkill: Int = 0
    private let tempN = Neuron()
    private let rand = Int.random(in: 0..<Int.max)
    private var kokoro = Kokoro(AbsDictionaryDB())
   
    init(skillsParams: DiSkillV2...) {
        for skill in skillsParams {
            skill.setKokoro(kokoro)
            skills.append(skill)
        }
    }
   
    func setKokoro(_ kokoro: Kokoro) {
        self.kokoro = kokoro
        for skill in skills {
            skill.setKokoro(kokoro)
        }
    }
   
    @discardableResult
    func addSkill(_ skill: DiSkillV2) -> SkillHubAlgDispenser {
        // Builder pattern
        skill.setKokoro(kokoro)
        skills.append(skill)
        return self
    }
   
    func dispenseAlgorithm(ear: String, skin: String, eye: String) -> AlgorithmV2? {
        // Return value to outAlg param of (external) summoner DiSkillV2
        skills[activeSkill].input(ear: ear, skin: skin, eye: eye)
        skills[activeSkill].output(tempN)
        for i in 1..<6 {
            if let temp = tempN.getAlg(i) {
                return AlgorithmV2(i, temp)
            }
        }
        return nil
    }
   
    func randomizeActiveSkill() {
        activeSkill = Int.random(in: 0..<skills.count)
    }
   
    func setActiveSkillWithMood(_ mood: Int) {
        // Mood integer represents active skill
        // Different mood = different behavior
        if mood > -1 && mood < skills.count {
            activeSkill = mood
        }
    }
   
    func cycleActiveSkill() {
        // Changes active skill
        // I recommend this method be triggered with a Learnability or SpiderSense object
        activeSkill += 1
        if activeSkill == skills.count {
            activeSkill = 0
        }
    }
   
    func getSize() -> Int {
        return skills.count
    }
}
 

fukurou

the supreme coder
ADMIN
Swift:
class SkillBranch: DiSkillV2 {
    // unique skill used to bind similar skills
    /*
    * contains collection of skills
    * mutates active skill if detects conjuration
    * mutates active skill if algorithm results in
    * negative feedback
    * positive feedback negates active skill mutation
    * */
    private var skillRef: [String: Int] = [:]
    private var skillHub = SkillHubAlgDispenser()
    private var ml: AXLearnability

    init(tolerance: Int) {
        ml = AXLearnability(tolerance: tolerance)
    }

    override func input(ear: String, skin: String, eye: String) {
        // conjuration alg morph
        if let skillIndex = skillRef[ear] {
            skillHub.setActiveSkillWithMood(skillIndex)
            setSimpleAlg("hmm")
        }
        // machine learning alg morph
        if ml.mutateAlg(ear: ear) {
            skillHub.cycleActiveSkill()
            setSimpleAlg("hmm")
        }
        // alg engage
        if let a1 = skillHub.dispenseAlgorithm(ear: ear, skin: skin, eye: eye) {
            self.outAlg = a1.getAlg()
            self.outpAlgPriority = a1.getPriority()
            ml.pendAlg()
        }
    }

    func addSkill(skill: DiSkillV2) {
        skillHub.addSkill(skill: skill)
    }

    func addReferencedSkill(skill: DiSkillV2, conjuration: String) {
        // the conjuration string will engage its respective skill
        skillHub.addSkill(skill: skill)
        skillRef[conjuration] = skillHub.getSize()
    }

    // learnability params
    func addDefcon(defcon: String) {
        ml.defcons.append(defcon)
    }

    func addGoal(goal: String) {
        ml.defcons.append(goal)
    }

    // while alg is pending, cause alg mutation ignoring learnability tolerance:
    func addDefconLV5(defcon5: String) {
        ml.defcons.append(defcon5)
    }

    override func setKokoro(kokoro: Kokoro) {
        super.setKokoro(kokoro: kokoro)
        skillHub.setKokoro(kokoro: kokoro)
    }
}
 

fukurou

the supreme coder
ADMIN
Swift:
class SkillBranch: DiSkillV2 {
    // unique skill used to bind similar skills
    /*
    * contains collection of skills
    * mutates active skill if detects conjuration
    * mutates active skill if algorithm results in
    * negative feedback
    * positive feedback negates active skill mutation
    * */
    private var skillRef: [String: Int] = [:]
    private var skillHub = SkillHubAlgDispenser()
    private var ml: AXLearnability

    init(tolerance: Int) {
        ml = AXLearnability()
        ml.trg.maxCount = tolerance
    }

    override func input(ear: String, skin: String, eye: String) {
        // conjuration alg morph
        if let skillIndex = skillRef[ear] {
            skillHub.setActiveSkillWithMood(skillIndex)
            setSimpleAlg(sayThis: "hmm")
        }
        // machine learning alg morph
        if ml.mutateAlg(input: ear) {
            skillHub.cycleActiveSkill()
            setSimpleAlg(sayThis: "hmm")
        }
        // alg engage
        if let a1 = skillHub.dispenseAlgorithm(ear: ear, skin: skin, eye: eye) {
            self.outAlg = a1.getAlg()
            self.outpAlgPriority = a1.getPriority()
            ml.pendAlg()
        }
    }

    func addSkill(_ skill:DiSkillV2) {
        skillHub.addSkill(skill)
    }

    func addReferencedSkill(skill: DiSkillV2, conjuration: String) {
        // the conjuration string will engage its respective skill
        skillHub.addSkill(skill)
        skillRef[conjuration] = skillHub.getSize()
    }

    // learnability params
    func addDefcon(_ defcon: String){ml.defcons.input(in1: defcon)}
    func addGoal(_ goal: String){ml.defcons.input(in1: goal)}
    // while alg is pending, cause alg mutation ignoring learnability tolerance:
    func addDefconLV5(_ defcon5: String){ml.defcons.input(in1: defcon5)}

    override func setKokoro(kokoro: Kokoro) {
        super.setKokoro(kokoro: kokoro)
        skillHub.setKokoro(kokoro)
    }
}
 

owly

闇の伝説
Staff member
戦闘 コーダー
team fuki be codin'

team fuki be codin'


can't stop TeamFuki from coding! :s68:


 

fukurou

the supreme coder
ADMIN
vb.net:
Code:
Public Class SkillHubAlgDispenser
    ' Super class to output an algorithm out of a selection of skills
    ' Engage the hub with dispenseAlg and return the value to outAlg attribute
    ' of the containing skill (which houses the skill hub)
    ' This module enables using a selection of 1 skill for triggers instead of having the triggers engage on multiple skills
    ' The method is ideal for learnability and behavioral modifications
    ' Use a learnability auxiliary module as a condition to run an active skill shuffle or change method
    ' (rndAlg, cycleAlg)
    ' Moods can be used for specific cases to change behavior of the AGI, for example low energy state
    ' For that use (moodAlg)

    Private ReadOnly skills As New List(Of DiSkillV2)()
    Private activeSkill As Integer = 0
    Private ReadOnly tempN As New Neuron()
    Private ReadOnly rand As New Random()
    Private kokoro As New Kokoro(New AbsDictionaryDB())

    Public Sub New(ParamArray skillsParams As DiSkillV2())
        For Each skill As DiSkillV2 In skillsParams
            skill.setKokoro(Me.kokoro)
            skills.Add(skill)
        Next
    End Sub

    Public Sub setKokoro(kokoro As Kokoro)
        Me.kokoro = kokoro
        For Each skill As DiSkillV2 In skills
            skill.setKokoro(Me.kokoro)
        Next
    End Sub

    Public Function addSkill(skill As DiSkillV2) As SkillHubAlgDispenser
        ' Builder pattern
        skill.setKokoro(Me.kokoro)
        skills.Add(skill)
        Return Me
    End Function

    Public Function dispenseAlgorithm(ear As String, skin As String, eye As String) As AlgorithmV2
        ' Return value to outAlg param of (external) summoner DiskillV2
        skills(activeSkill).input(ear, skin, eye)
        skills(activeSkill).output(tempN)
        For i As Integer = 1 To 5
            Dim temp As Algorithm = tempN.getAlg(i)
            If temp IsNot Nothing Then
                Return New AlgorithmV2(i, temp)
            End If
        Next
        Return Nothing
    End Function

    Public Sub randomizeActiveSkill()
        activeSkill = rand.Next(skills.Count)
    End Sub

    Public Sub setActiveSkillWithMood(mood As Integer)
        ' Mood integer represents active skill
        ' Different mood = different behavior
        If mood > -1 AndAlso mood < skills.Count Then
            activeSkill = mood
        End If
    End Sub

    Public Sub cycleActiveSkill()
        ' Changes active skill
        ' I recommend this method be triggered with a Learnability or SpiderSense object
        activeSkill += 1
        If activeSkill = skills.Count Then
            activeSkill = 0
        End If
    End Sub

    Public Function getSize() As Integer
        Return skills.Count
    End Function
End Class
 

fukurou

the supreme coder
ADMIN
Code:
Public Class SkillBranch
    Inherits DiSkillV2

    ' unique skill used to bind similar skills
    ' contains collection of skills
    ' mutates active skill if detects conjuration
    ' mutates active skill if algorithm results in
    ' negative feedback
    ' positive feedback negates active skill mutation

    Private skillRef As New Hashtable()
    Private skillHub As New SkillHubAlgDispenser()
    Private ml As AXLearnability

    Public Sub New(tolerance As Integer)
        ml = New AXLearnability(tolerance)
    End Sub

    Public Overrides Sub input(ear As String, skin As String, eye As String)
        ' conjuration alg morph
        If skillRef.ContainsKey(ear) Then
            skillHub.setActiveSkillWithMood(skillRef(ear))
            setSimpleAlg("hmm")
        End If

        ' machine learning alg morph
        If ml.mutateAlg(ear) Then
            skillHub.cycleActiveSkill()
            setSimpleAlg("hmm")
        End If

        ' alg engage
        Dim a1 As AlgorithmV2 = skillHub.dispenseAlgorithm(ear, skin, eye)
        If a1 Is Nothing Then Return

        Me.outAlg = a1.getAlg()
        Me.outpAlgPriority = a1.getPriority()
        ml.pendAlg()
    End Sub

    Public Sub addSkill(skill As DiSkillV2)
        skillHub.addSkill(skill)
    End Sub

    Public Sub addReferencedSkill(skill As DiSkillV2, conjuration As String)
        ' the conjuration string will engage its respective skill
        skillHub.addSkill(skill)
        skillRef(conjuration) = skillHub.getSize()
    End Sub

    ' learnability params
    Public Sub addDefcon(defcon As String)
        ml.defcons.Add(defcon)
    End Sub

    Public Sub addGoal(goal As String)
        ml.defcons.Add(goal)
    End Sub

    ' while alg is pending, cause alg mutation ignoring learnability tolerance:
    Public Sub addDefconLV5(defcon5 As String)
        ml.defcons.Add(defcon5)
    End Sub

    Public Overrides Sub setKokoro(kokoro As Kokoro)
        MyBase.setKokoro(kokoro)
        skillHub.setKokoro(kokoro)
    End Sub
End Class
 
Top