skill branch upgrade

fukurou

the supreme coder
ADMIN
vb.net

Code:
Public Class AXLearnability
    Private algSent As Boolean = False
    ' Problems that may result because of the last deployed algorithm:
    Public defcons As HashSet(Of String) = New HashSet(Of String)()
    ' Major chaotic problems that may result because of the last deployed algorithm:
    Public defcon5 As HashSet(Of String) = New HashSet(Of String)()
    ' Goals the last deployed algorithm aims to achieve:
    Public goals As HashSet(Of String) = New HashSet(Of String)()
    ' How many failures / problems till the algorithm needs to mutate (change)
    Public trgTolerance As TrgTolerance

    Public Sub New(tolerance As Integer)
        trgTolerance = New TrgTolerance(tolerance)
        trgTolerance.reset()
    End Sub

    Public Sub pendAlg()
        ' An algorithm has been deployed
        ' Call this method when an algorithm is deployed (in a DiSkillV2 object)
        algSent = True
        trgTolerance.trigger()
    End Sub

    Public Sub pendAlgWithoutConfirmation()
        ' An algorithm has been deployed
        algSent = True
        ' No need to await for a thank you or check for goal manifestation :
        ' trgTolerance.trigger()
        ' Using this method instead of the default "pendAlg" is the same as
        ' giving importance to the stick and not the carrot when learning
        ' This method is mostly fitting workplace situations
    End Sub

    Public Function mutateAlg(input As String) As Boolean
        ' Recommendation to mutate the algorithm? true/false
        If Not algSent Then Return False ' No alg sent => no reason to mutate
        If goals.Contains(input) Then
            trgTolerance.reset()
            algSent = False
            Return False
        End If
        ' Goal manifested; the sent algorithm is good => no need to mutate the alg
        If defcon5.Contains(input) Then
            trgTolerance.reset()
            algSent = False
            Return True
        End If
        ' ^ Something bad happened probably because of the sent alg
        ' Recommend alg mutation
        If defcons.Contains(input) Then
            algSent = False
            Dim mutate As Boolean = Not trgTolerance.trigger()
            If mutate Then
                trgTolerance.reset()
            End If
            Return mutate
        End If
        ' ^ Negative result, mutate the alg if this occurs too much
        Return False
    End Function

    Public Sub resetTolerance()
        ' Use when you run code to change algorithms regardless of learnability
        trgTolerance.reset()
    End Sub
End Class

Code:
Public Class SkillBranch1Liner
    Inherits SkillBranch

    Public Sub New(goal As String, defcon As String, tolerance As Integer, ParamArray skills() As Skill)
        MyBase.New(tolerance)
        Me.addGoal(goal)
        Me.addDefcon(defcon)
        For Each skill As Skill In skills
            Me.addSkill(skill)
        Next
    End Sub
End Class
 

fukurou

the supreme coder
ADMIN
C#:
public class AXLearnability
{
    private bool algSent = false;
    // Problems that may result because of the last deployed algorithm:
    public HashSet<string> defcons = new HashSet<string>();
    // Major chaotic problems that may result because of the last deployed algorithm:
    public HashSet<string> defcon5 = new HashSet<string>();
    // Goals the last deployed algorithm aims to achieve:
    public HashSet<string> goals = new HashSet<string>();
    // How many failures / problems till the algorithm needs to mutate (change)
    public TrgTolerance trgTolerance;

    public AXLearnability(int tolerance)
    {
        trgTolerance = new TrgTolerance(tolerance);
        trgTolerance.reset();
    }

    public void pendAlg()
    {
        // An algorithm has been deployed
        // Call this method when an algorithm is deployed (in a DiSkillV2 object)
        algSent = true;
        trgTolerance.trigger();
    }

    public void pendAlgWithoutConfirmation()
    {
        // An algorithm has been deployed
        algSent = true;
        // No need to await for a thank you or check for goal manifestation :
        // trgTolerance.trigger();
        // Using this method instead of the default "pendAlg" is the same as
        // giving importance to the stick and not the carrot when learning
        // This method is mostly fitting workplace situations
    }

    public bool mutateAlg(string input)
    {
        // Recommendation to mutate the algorithm? true/false
        if (!algSent) return false; // No alg sent => no reason to mutate
        if (goals.Contains(input))
        {
            trgTolerance.reset();
            algSent = false;
            return false;
        }
        // Goal manifested; the sent algorithm is good => no need to mutate the alg
        if (defcon5.Contains(input))
        {
            trgTolerance.reset();
            algSent = false;
            return true;
        }
        // ^ Something bad happened probably because of the sent alg
        // Recommend alg mutation
        if (defcons.Contains(input))
        {
            algSent = false;
            bool mutate = !trgTolerance.trigger();
            if (mutate)
            {
                trgTolerance.reset();
            }
            return mutate;
        }
        // ^ Negative result, mutate the alg if this occurs too much
        return false;
    }

    public void resetTolerance()
    {
        // Use when you run code to change algorithms regardless of learnability
        trgTolerance.reset();
    }
}
 

fukurou

the supreme coder
ADMIN
Python:
class AXLearnability:
    def __init__(self, tolerance):
        self.algSent = False
        # Problems that may result because of the last deployed algorithm:
        self.defcons = set()
        # Major chaotic problems that may result because of the last deployed algorithm:
        self.defcon5 = set()
        # Goals the last deployed algorithm aims to achieve:
        self.goals = set()
        # How many failures / problems till the algorithm needs to mutate (change)
        self.trgTolerance = TrgTolerance(tolerance)
        self.trgTolerance.reset()

    def pendAlg(self):
        # An algorithm has been deployed
        # Call this method when an algorithm is deployed (in a DiSkillV2 object)
        self.algSent = True
        self.trgTolerance.trigger()

    def pendAlgWithoutConfirmation(self):
        # An algorithm has been deployed
        self.algSent = True
        # No need to await for a thank you or check for goal manifestation:
        # self.trgTolerance.trigger()
        # Using this method instead of the default "pendAlg" is the same as
        # giving importance to the stick and not the carrot when learning
        # This method is mostly fitting workplace situations

    def mutateAlg(self, input):
        # Recommendation to mutate the algorithm? true/false
        if not self.algSent:
            return False  # No alg sent => no reason to mutate
        if input in self.goals:
            self.trgTolerance.reset()
            self.algSent = False
            return False
        # Goal manifested; the sent algorithm is good => no need to mutate the alg
        if input in self.defcon5:
            self.trgTolerance.reset()
            self.algSent = False
            return True
        # ^ Something bad happened probably because of the sent alg
        # Recommend alg mutation
        if input in self.defcons:
            self.algSent = False
            mutate = not self.trgTolerance.trigger()
            if mutate:
                self.trgTolerance.reset()
            return mutate
        # ^ Negative result, mutate the alg if this occurs too much
        return False

    def resetTolerance(self):
        # Use when you run code to change algorithms regardless of learnability
        self.trgTolerance.reset()
 

fukurou

the supreme coder
ADMIN
Python:
class SkillBranch1Liner(SkillBranch):
    def __init__(self, goal, defcon, tolerance, *skills):
        super().__init__(tolerance)
        self.addGoal(goal)
        self.addDefcon(defcon)
        for skill in skills:
            self.addSkill(skill)
 

fukurou

the supreme coder
ADMIN
Swift:
class AXLearnability {
    private var algSent = false
    // Problems that may result because of the last deployed algorithm
    var defcons = Set<String>()
    // Major chaotic problems that may result because of the last deployed algorithm
    var defcon5 = Set<String>()
    // Goals the last deployed algorithm aims to achieve
    var goals = Set<String>()
    // How many failures/problems till the algorithm needs to mutate (change)
    var trgTolerance: TrgTolerance

    init(tolerance: Int) {
        self.trgTolerance = TrgTolerance(tolerance: tolerance)
        trgTolerance.reset()
    }

    func pendAlg() {
        // An algorithm has been deployed
        // Call this method when an algorithm is deployed (in a DiSkillV2 object)
        algSent = true
        trgTolerance.trigger()
    }

    func pendAlgWithoutConfirmation() {
        // An algorithm has been deployed
        algSent = true
        // No need to await for a thank you or check for goal manifestation
        // trgTolerance.trigger()
        // Using this method instead of the default "pendAlg" is the same as
        // giving importance to the stick and not the carrot when learning
        // This method is mostly fitting workplace situations
    }

    func mutateAlg(input: String) -> Bool {
        // Recommendation to mutate the algorithm? true/false
        guard algSent else { return false } // No alg sent => no reason to mutate
        if goals.contains(input) {
            trgTolerance.reset()
            algSent = false
            return false
        }
        // Goal manifested the sent algorithm is good => no need to mutate the alg
        if defcon5.contains(input) {
            trgTolerance.reset()
            algSent = false
            return true
        }
        // Something bad happened probably because of the sent alg
        // Recommend alg mutation
        if defcons.contains(input) {
            algSent = false
            let mutate = !trgTolerance.trigger()
            if mutate {
                trgTolerance.reset()
            }
            return mutate
        }
        // Negative result, mutate the alg if this occurs too much
        return false
    }

    func resetTolerance() {
        // Use when you run code to change algorithms regardless of learnability
        trgTolerance.reset()
    }
}
 
Last edited:

fukurou

the supreme coder
ADMIN
Swift:
class SkillBranch1Liner: SkillBranch {
    init(goal: String, defcon: String, tolerance: Int, skills: Skill...) {
        super.init(tolerance: tolerance)
        self.addGoal(goal)
        self.addDefcon(defcon)
        for skill in skills {
            self.addSkill(skill)
        }
    }
}
 
Last edited:
Top