Moti Barski super


Posts : 511 Join date : 2011-08-02
 | Subject: new skill type for livingrimoire AGI software design pattern: DiSkillV2 Thu Mar 25, 2021 5:36 am | |
| java class DiSkillV2: this is a faster cleaner to use new version of the old version - Code:
-
public class DiSkillV2 extends AbsCmdReq { protected Kokoro kokoro; // consciousness, shallow ref class to enable interskill communications protected DISkillUtils diSkillUtils = new DISkillUtils(); protected Algorithm outAlg = null; // skills output
public DiSkillV2(Kokoro kokoro) { super(); this.kokoro = kokoro; }
@Override public void input(String ear, String skin, String eye) { } @Override public final void output(Neuron noiron) { if (outAlg != null) { noiron.algParts.add(outAlg); outAlg = null; } } } _________________ MB over and out  | |
|
Moti Barski super


Posts : 511 Join date : 2011-08-02
 | Subject: Re: new skill type for livingrimoire AGI software design pattern: DiSkillV2 Thu Mar 25, 2021 5:37 am | |
| notice it also contains a class to facilitate creating algorithms which has also been updated - Code:
-
import java.util.ArrayList;
public class DISkillUtils { public Algorithm verbatimGorithm(AbsAlgPart itte) { // returns a simple algorithm containing 1 alg part String representation = "util"; ArrayList<AbsAlgPart> algParts1 = new ArrayList<>(); algParts1.add(itte); Algorithm algorithm = new Algorithm("util", representation, algParts1); return algorithm; }
public Algorithm verbatimGorithm(String algMarker, AbsAlgPart itte) { // returns a simple algorithm for saying sent parameter String representation = "util"; ArrayList<AbsAlgPart> algParts1 = new ArrayList<>(); algParts1.add(itte); Algorithm algorithm = new Algorithm("util", representation, algParts1); return algorithm; }
public Algorithm customizedVerbatimGorithm(String algMarker, AbsAlgPart itte) { // the most stable and advanced algorithm builder // returns a simple algorithm containing 1 alg part String representation = "r_" + algMarker; ArrayList<AbsAlgPart> algParts1 = new ArrayList<>(); algParts1.add(itte); Algorithm algorithm = new Algorithm(algMarker, representation, algParts1); return algorithm; }
public Algorithm customizedVerbatimGorithm(String algMarker, AbsAlgPart... itte) { // the most stable and advanced algorithm builder // returns a simple algorithm containing 1 alg part String representation = "r_" + algMarker; ArrayList<AbsAlgPart> algParts1 = new ArrayList<>(); for (int i = 0; i < itte.length; i++) { algParts1.add(itte[i]); } Algorithm algorithm = new Algorithm(algMarker, representation, algParts1); return algorithm; }
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 ""; } } _________________ MB over and out  | |
|