battle programmers alliance
Would you like to react to this message? Create an account in a few clicks or log in to continue.

battle programmers allianceLog in

the LivinGrimoire Artificial General Intelligence software design pattern forum

descriptionnew skill type for livingrimoire AGI software design pattern: DiSkillV2 Emptynew skill type for livingrimoire AGI software design pattern: DiSkillV2

more_horiz
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;
      }
   }
}


:NGL: :ON:

descriptionnew skill type for livingrimoire AGI software design pattern: DiSkillV2 EmptyRe: new skill type for livingrimoire AGI software design pattern: DiSkillV2

more_horiz
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 "";
   }
}
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply