habit skill

fukurou

the supreme coder
ADMIN
Java:
package skills;

import AXJava.AXCmdBreaker;
import AXJava.AXStrOrDefault;
import AXJava.TODOListManager;
import AXJava.UniqueItemSizeLimitedPriorityQueue;
import LivinGrimoire.APVerbatim;
import LivinGrimoire.DISkillUtils;
import LivinGrimoire.DiSkillV2;

import java.util.ArrayList;

public class DiHabit extends DiSkillV2 {
    /*setter params*/
    // habit params
    private UniqueItemSizeLimitedPriorityQueue habitsPositive = new UniqueItemSizeLimitedPriorityQueue();
    private AXCmdBreaker habitP = new AXCmdBreaker("i should");
    private String temp = "";
    // bad habits
    private UniqueItemSizeLimitedPriorityQueue habitsNegative = new UniqueItemSizeLimitedPriorityQueue();
    private AXCmdBreaker habitN = new AXCmdBreaker("i must not");
    // dailies
    private UniqueItemSizeLimitedPriorityQueue dailies = new UniqueItemSizeLimitedPriorityQueue();
    private AXCmdBreaker dailyCmdBreaker = new AXCmdBreaker("i out to");
    // weekends
    private UniqueItemSizeLimitedPriorityQueue weekends = new UniqueItemSizeLimitedPriorityQueue();
    private AXCmdBreaker weekendCmdBreaker = new AXCmdBreaker("i have to");
    // expirations
    private UniqueItemSizeLimitedPriorityQueue expirations = new UniqueItemSizeLimitedPriorityQueue();
    private AXCmdBreaker expirationsCmdBreaker = new AXCmdBreaker("i got to");
    // to-do list
    private TODOListManager todo = new TODOListManager(5);
    private AXCmdBreaker toDoCmdBreaker = new AXCmdBreaker("i need to");
    private AXCmdBreaker clearCmdBreaker = new AXCmdBreaker("clear");
    //getter param
    private AXCmdBreaker getterCmdBreaker = new AXCmdBreaker("random");
    private AXStrOrDefault strOrDefault = new AXStrOrDefault();

    public DiHabit() {
        habitsPositive.setLimit(15);
        habitsNegative.setLimit(5);
        dailies.setLimit(3);
        weekends.setLimit(3);
        expirations.setLimit(3);
    }

    @Override
    public void input(String ear, String skin, String eye) {
        if (ear.isEmpty()){return;}
        // setters
        if (ear.contains("i")){
            temp = habitP.extractCmdParam(ear);
            if (!temp.isEmpty()){
                habitsPositive.add(temp);
                temp = "";
                setVerbatimAlg(4,"habit registered");
                return;
            }
            temp = habitN.extractCmdParam(ear);
            if (!temp.isEmpty()){
                habitsNegative.add(temp);
                temp = "";
                setVerbatimAlg(4,"bad habit registered");
                return;
            }
            temp = dailyCmdBreaker.extractCmdParam(ear);
            if (!temp.isEmpty()){
                dailies.add(temp);
                temp = "";
                setVerbatimAlg(4,"daily registered");
                return;
            }
            temp = weekendCmdBreaker.extractCmdParam(ear);
            if (!temp.isEmpty()){
                weekends.add(temp);
                temp = "";
                setVerbatimAlg(4,"prep registered");
                return;
            }
            temp = expirationsCmdBreaker.extractCmdParam(ear);
            if (!temp.isEmpty()){
                expirations.add(temp);
                temp = "";
                setVerbatimAlg(4,"expiration registered");
                return;
            }
            temp = toDoCmdBreaker.extractCmdParam(ear);
            if (!temp.isEmpty()){
                todo.addTask(temp);
                temp = "";
                setVerbatimAlg(4,"task registered");
                return;
            }
        }
        // getters
        temp = getterCmdBreaker.extractCmdParam(ear);
        if (!temp.isEmpty()){
            switch (temp){
                case "habit":
                    setVerbatimAlg(4,strOrDefault.getOrDefault(habitsPositive.getRNDElement(),"no habits registered"));
                    return;
                case "bad habit":
                    setVerbatimAlg(4,strOrDefault.getOrDefault(habitsNegative.getRNDElement(),"no bad habits registered"));
                    return;
                case "daily":
                    setVerbatimAlg(4,strOrDefault.getOrDefault(dailies.getRNDElement(),"no dailies registered"));
                    return;
                case "weekend": case "prep":
                    setVerbatimAlg(4,strOrDefault.getOrDefault(weekends.getRNDElement(),"no preps registered"));
                    return;
                case "expirations":case "expiration":
                    if(expirations.getAsList().isEmpty()){
                        setVerbatimAlg(4,"no expirations registered");
                        return;
                    }
                    setVerbatimAlgFromList(4,expirations.getAsList());
                    return;
                case "task":
                    setVerbatimAlg(4,strOrDefault.getOrDefault(todo.getTask(),"no tasks registered"));
                    return;
                case "to do":
                    setVerbatimAlg(4,strOrDefault.getOrDefault(todo.getOldTask(),"no tasks registered"));
                    return;
            }
        }
        // engagers
        if(ear.contains("completed")){
            if (!(diSkillUtils.strContainsList(ear,habitsPositive.getAsList()).isEmpty())){
                setVerbatimAlg(4,"good boy");
                return;
            }
            if (!(diSkillUtils.strContainsList(ear,habitsNegative.getAsList()).isEmpty())){
                setVerbatimAlg(4,"bad boy");
                return;
            }
            if (!(diSkillUtils.strContainsList(ear,dailies.getAsList()).isEmpty())){
                setVerbatimAlg(4,"daily engaged");
                return;
            }
            if (!(diSkillUtils.strContainsList(ear,weekends.getAsList()).isEmpty())){
                setVerbatimAlg(4,"prep engaged");
                return;
            }
            // expiration gamification redacted
        }
        // clear specific field
        switch(ear) {
            case "clear habits":
                habitsPositive.clear();
                setVerbatimAlg(4,"habits cleared");
                break;
            case "clear bad habits":
                habitsNegative.clear();
                setVerbatimAlg(4,"bad habits cleared");
                break;
            case "clear dailies":
                dailies.clear();
                setVerbatimAlg(4,"dailies cleared");
                break;
            case "clear preps": case "clear weekends":
                weekends.clear();
                setVerbatimAlg(4,"preps cleared");
                break;
            case "clear expirations":
                expirations.clear();
                setVerbatimAlg(4,"expirations cleared");
                break;
            case "clear tasks":case "clear task":case "clear to do":
                todo.clearAllTasks();
                setVerbatimAlg(4,"tasks cleared");
                break;
            case "clear all habits":
                habitsPositive.clear();
                habitsNegative.clear();
                dailies.clear();
                weekends.clear();
                expirations.clear();
                todo.clearAllTasks();
                setVerbatimAlg(4,"all habits cleared");
                break;
            default:
                if (ear.contains("clear")){
                    temp = clearCmdBreaker.extractCmdParam(ear);
                    if(todo.containsTask(temp)){
                        todo.clearTask(temp);
                        setVerbatimAlg(4,temp +" task cleared");
                        temp = "";
                    }
                }
        }
    }
    protected void setVerbatimAlgFromList(int priority, ArrayList<String> sayThis){
        this.outAlg = this.diSkillUtils.onePartAlgorithmWithRepresantation(new APVerbatim(sayThis));
        this.outpAlgPriority = priority; // 1->5 1 is the highest algorithm priority
    }
}
 

owly

闇の伝説
Staff member
戦闘 コーダー
we'll be untangling this cluster fuck next:
Java:
public class DISkillUtils {
    // alg part based algorithm building methodes
    public Algorithm onePartAlgorithm(Mutatable algPart) {
        // returns a simple algorithm containing 1 alg part
        ArrayList<Mutatable> algParts1 = new ArrayList<>();
        algParts1.add(algPart);
        Algorithm algorithm = new Algorithm(algParts1);
        return algorithm;
    }
    // var args param
    public Algorithm algBuilder(Mutatable... algParts) {
        // returns a simple algorithm for saying sent parameter
        ArrayList<Mutatable> algParts1 = new ArrayList<>();
        for (int i = 0; i < algParts.length; i++) {
            algParts1.add(algParts[i]);
        }
        Algorithm algorithm = new Algorithm(algParts1);
        return algorithm;
    }
    public Algorithm onePartAlgorithmWithRepresantation(Mutatable algPart) {
        // returns a simple algorithm containing 1 alg part
        ArrayList<Mutatable> algParts1 = new ArrayList<>();
        algParts1.add(algPart);
        Algorithm algorithm = new Algorithm(algParts1);
        return algorithm;
    }
    public Algorithm algBuilderWithRepresantation(Mutatable... algParts) {
        // returns a simple algorithm for saying sent parameter
        ArrayList<Mutatable> algParts1 = new ArrayList<>();
        for (int i = 0; i < algParts.length; i++) {
            algParts1.add(algParts[i]);
        }
        Algorithm algorithm = new Algorithm(algParts1);
        return algorithm;
    }
    // String part based algorithm building methodes
    public Algorithm simpleVerbatimAlgorithm(String... sayThis) {
        // returns alg that says the word string (sayThis)
        return onePartAlgorithm(new APVerbatim(sayThis));
    }
    public Algorithm simpleVerbatimAlgorithmWithRepresantation(String... sayThis) {
        // returns alg that says the word string (sayThis)
        return onePartAlgorithmWithRepresantation(new APVerbatim(sayThis));
    }
    // String part based algorithm building methodes with cloudian (shallow ref object to inform on alg completion)
    public Algorithm simpleCloudiandVerbatimAlgorithmWithRepresantation(CldBool cldBool, String... sayThis) {
        // returns alg that says the word string (sayThis)
        return onePartAlgorithmWithRepresantation(new APCldVerbatim(cldBool, sayThis));
    }
    public Algorithm simpleCloudiandVerbatimAlgorithm(CldBool cldBool, String... sayThis) {
        // returns alg that says the word string (sayThis)
        return onePartAlgorithm(new APCldVerbatim(cldBool, sayThis));
    }
    public String strContainsList(String str1, ArrayList<String> items) {
        // returns the 1st match between words in a string and values in a list.
        for (String temp : items) {
            if (str1.contains(temp)) {
                return temp;
            }
        }
        return "";
    }
}
 

fukurou

the supreme coder
ADMIN
we'll be untangling this cluster fuck next:
Java:
public class DISkillUtils {
    // alg part based algorithm building methodes
    public Algorithm onePartAlgorithm(Mutatable algPart) {
        // returns a simple algorithm containing 1 alg part
        ArrayList<Mutatable> algParts1 = new ArrayList<>();
        algParts1.add(algPart);
        Algorithm algorithm = new Algorithm(algParts1);
        return algorithm;
    }
    // var args param
    public Algorithm algBuilder(Mutatable... algParts) {
        // returns a simple algorithm for saying sent parameter
        ArrayList<Mutatable> algParts1 = new ArrayList<>();
        for (int i = 0; i < algParts.length; i++) {
            algParts1.add(algParts[i]);
        }
        Algorithm algorithm = new Algorithm(algParts1);
        return algorithm;
    }
    public Algorithm onePartAlgorithmWithRepresantation(Mutatable algPart) {
        // returns a simple algorithm containing 1 alg part
        ArrayList<Mutatable> algParts1 = new ArrayList<>();
        algParts1.add(algPart);
        Algorithm algorithm = new Algorithm(algParts1);
        return algorithm;
    }
    public Algorithm algBuilderWithRepresantation(Mutatable... algParts) {
        // returns a simple algorithm for saying sent parameter
        ArrayList<Mutatable> algParts1 = new ArrayList<>();
        for (int i = 0; i < algParts.length; i++) {
            algParts1.add(algParts[i]);
        }
        Algorithm algorithm = new Algorithm(algParts1);
        return algorithm;
    }
    // String part based algorithm building methodes
    public Algorithm simpleVerbatimAlgorithm(String... sayThis) {
        // returns alg that says the word string (sayThis)
        return onePartAlgorithm(new APVerbatim(sayThis));
    }
    public Algorithm simpleVerbatimAlgorithmWithRepresantation(String... sayThis) {
        // returns alg that says the word string (sayThis)
        return onePartAlgorithmWithRepresantation(new APVerbatim(sayThis));
    }
    // String part based algorithm building methodes with cloudian (shallow ref object to inform on alg completion)
    public Algorithm simpleCloudiandVerbatimAlgorithmWithRepresantation(CldBool cldBool, String... sayThis) {
        // returns alg that says the word string (sayThis)
        return onePartAlgorithmWithRepresantation(new APCldVerbatim(cldBool, sayThis));
    }
    public Algorithm simpleCloudiandVerbatimAlgorithm(CldBool cldBool, String... sayThis) {
        // returns alg that says the word string (sayThis)
        return onePartAlgorithm(new APCldVerbatim(cldBool, sayThis));
    }
    public String strContainsList(String str1, ArrayList<String> items) {
        // returns the 1st match between words in a string and values in a list.
        for (String temp : items) {
            if (str1.contains(temp)) {
                return temp;
            }
        }
        return "";
    }
}
Java:
import java.util.ArrayList;

public class DISkillUtils {
    // alg part based algorithm building methods
    // var args param
    public Algorithm algBuilder(Mutatable... algParts) {
        // returns a simple algorithm for saying sent parameter
        ArrayList<Mutatable> algParts1 = new ArrayList<>();
        for (int i = 0; i < algParts.length; i++) {
            algParts1.add(algParts[i]);
        }
        Algorithm algorithm = new Algorithm(algParts1);
        return algorithm;
    }
    // String part based algorithm building methodes
    public Algorithm simpleVerbatimAlgorithm(String... sayThis) {
        // returns alg that says the word string (sayThis)
        return algBuilder(new APVerbatim(sayThis));
    }
    // String part based algorithm building methodes with cloudian (shallow ref object to inform on alg completion)
    public Algorithm simpleCloudiandVerbatimAlgorithm(CldBool cldBool, String... sayThis) {
        // returns alg that says the word string (sayThis)
        return algBuilder(new APCldVerbatim(cldBool, sayThis));
    }
    public String strContainsList(String str1, ArrayList<String> items) {
        // returns the 1st match between words in a string and values in a list.
        for (String temp : items) {
            if (str1.contains(temp)) {
                return temp;
            }
        }
        return "";
    }
}

and now I shall take a shit! :s21:
 

fukurou

the supreme coder
ADMIN
Java:
package LivinGrimoire;

import java.util.ArrayList;

public class DiSkillV2 {
    protected Kokoro kokoro = new Kokoro(new AbsDictionaryDB()); // consciousness, shallow ref class to enable interskill communications
    protected DISkillUtils diSkillUtils = new DISkillUtils();
    protected Algorithm outAlg = null; // skills output
    protected int outpAlgPriority = -1; // defcon 1->5

    public DiSkillV2() {
        super();
    }
    // skill triggers and algorithmic logic
    public void input(String ear, String skin, String eye) {
    }
    // extraction of skill algorithm to run (if there is one)
    public void output(Neuron noiron) {
        if (outAlg != null) {
            noiron.insertAlg(this.outpAlgPriority,outAlg);
            outpAlgPriority = -1;
            outAlg = null;
        }
    }
    public void setKokoro(Kokoro kokoro) {
        // use this for telepathic communication between different chobits objects
        this.kokoro = kokoro;
    }
    // in skill algorithm building shortcut methods:
    protected void setVerbatimAlg(int priority, String... sayThis){
        // build a simple output algorithm to speak string by string per think cycle
        // uses varargs param
        this.outAlg = this.diSkillUtils.simpleVerbatimAlgorithm(sayThis);
        this.outpAlgPriority = priority; // 1->5 1 is the highest algorithm priority
    }
    protected void setVerbatimAlgFromList(int priority, ArrayList<String> sayThis){
        // build a simple output algorithm to speak string by string per think cycle
        // uses list param
        this.outAlg = this.diSkillUtils.algBuilder(new APVerbatim(sayThis));
        this.outpAlgPriority = priority; // 1->5 1 is the highest algorithm priority
    }
    protected void algPartsFusion(int priority,Mutatable... algParts){
        // build a custom algorithm out of a chain of algorithm parts(actions)
        this.outAlg = this.diSkillUtils.algBuilder(algParts);
        this.outpAlgPriority = priority; // 1->5 1 is the highest algorithm priority
    }
}
 

fukurou

the supreme coder
ADMIN
Java:
package LivinGrimoire;

public class DiHelloWorld extends DiSkillV2{
    // hello world skill for testing purposes
    public DiHelloWorld() {
        super();
    }

    @Override
    public void input(String ear, String skin, String eye) {
        switch (ear){
            case "hello":
                super.setVerbatimAlg(4,"hello world");
                break;
        }
    }
}

it sucks that humans haven't evolved enough to comprehend my genius but this code is pure jizz fuel :s32:
 
Top