battle programming a forum for elite programmers with extreme will power to sharpen theire skills
 
HomeSearchRegisterLog in
Share
 

 beyond omega level coding

Go down 
AuthorMessage
Moti Barski
super
super
Moti Barski

Posts : 395
Join date : 2011-08-02

beyond omega level coding Empty
PostSubject: beyond omega level coding   beyond omega level coding EmptyFri May 17, 2019 7:29 pm

contents

_________________
MB over and out emp it up
Back to top Go down
Moti Barski
super
super
Moti Barski

Posts : 395
Join date : 2011-08-02

beyond omega level coding Empty
PostSubject: moti barskis livinGrimoire   beyond omega level coding EmptyFri May 17, 2019 7:41 pm

about the programmer that created the living grimoire : Moti Barski, Battle programmer.

I moti barski do not allow anyone and or anybody and or any organization to
receive monetary profit from this living grimoire unless writtenly approved by me personally.
you can use this for research.

name of the software : living grimoire : LG for short
what it is : an A.G.I platform.

intro :

how could coders have been coding this way for so long ?
they get some lame project, and they gotta start all over again building from scratch :

menues, the basics, rethink the algorithms and how to fit them into the small and big picture.
no matter how many projects you finished, with each project you would have to start over.

over time you would remember the main thinking patterns for solving puzzles BUT !,
codes and mini algorithms, there is no way to remember all of that.
you try to keep up to date with the latest codes and walkthroughs to no avail as
they expire you forget them and have to search for them again.
with doing the above you waste so much time that by the time you finish, the codes
you learnt are obsolete, in other words you are chasing rainbows.

like a carpet being pulled from under you, you gotta now readdapt your algs and codes
all over again to the new project.

even with design patterns many coders find that they need to adapt to them rather the other
way.

here it is different, it is truely amazing !

with this new way, battle programming, you are in a 7 star hotel in the buffet
and all you have to do is pick the skills you want and need for your project.

then assemble said skills with just one line of code per skill.
next, you can enjoy a nice anime or bike ride, cause your project is done.

**********************************************************************************************


method of operation overview: the LG can absorb skills and use them

what is a skill ?
a skill cosists of 2 factors : a summoner and actions.

summoner (referred to as a Dclass (a class whos name starts with D)):
input passing through a DClass can trigger the summoning of an algorithm
with actual time OR ear, eye, and other types of input as a string.

what is an algorithm ? a combination of alg parts

what is an alg part ?
an alg part is an action. an alg part class name starts with AP.
at each think cycle said action does one thing.

example DSayer class :

Code:

import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import PKGsystemClasses.APSay;
import PKGsystemClasses.AbsAlgPart;
import PKGsystemClasses.Algorithm;
import PKGsystemClasses.Neuron;
import PKGsystemClasses.Neuronable;

public class DSayer extends AbsCmdReq implements Neuronable {
   private int times;
   private String param;

   public DSayer() {
      super();
      this.times = 1;
      this.param = "";
   }

   public static String regexChecker(String theRegex, String str2Check) {
      Pattern checkRegex = Pattern.compile(theRegex);
      Matcher regexMatcher = checkRegex.matcher(str2Check);
      while (regexMatcher.find()) {
         if (regexMatcher.group().length() != 0) {
            return regexMatcher.group().trim();
         }
      }
      return "";
   }

   @Override
   public void input(String command) {
      int foo = 1;
      String myString = regexChecker("(\\d+)(?= times)", command);
      String toSay = regexChecker("(?<=say)(.*)(?=\\d)", command);
      if (myString != "") {
         foo = Integer.parseInt(myString);
      } else {
         toSay = regexChecker("(?<=say)(.*)", command);
      }
      this.param = toSay;
      this.times = foo;
   }

   @Override
   public void output(Neuron noiron) {
      // TODO Auto-generated method stub
      if (!param.isEmpty()) {
         AbsAlgPart itte = new APSay(this.times, this.param);
         String representation = "say " + param;
         if (this.times > 1) {
            representation += " " + this.times + " times";
         }
         ArrayList<AbsAlgPart> algParts1 = new ArrayList<>();
         algParts1.add(itte);
         Algorithm algorithm = new Algorithm("say", representation, algParts1);
         noiron.algParts.add(algorithm);
      }

   }
}

example APclass :

Code:


/* it speaks something x times
 * a most basic skill.
 * also fun to make the chobit say what you want
 * */
public class APSay extends AbsAlgPart {
    protected String param;
    private int at;

    public APSay(int at, String param) {
        super();
        if (at > 10) {
            at = 10;
        }
        this.at = at;
        this.param = param;
    }

    @Override
    public String action(String input) {
        // TODO Auto-generated method stub
        String axnStr = "";
        if (this.at > 0) {
            if (!input.equalsIgnoreCase(param)) {
                axnStr = param;
                at--;
            }
        }
        return axnStr;
    }

    @Override
    public enumFail failure(String input) {
        // TODO Auto-generated method stub
        return enumFail.ok;
    }

    @Override
    public Boolean completed() {
        // TODO Auto-generated method stub
        return at < 1;
    }

    @Override
    public AbsAlgPart clone() {
        // TODO Auto-generated method stub
        return new APSay(this.at, this.param);
    }

   @Override
   public Boolean itemize() {
      // TODO add logic
      // at home
      return true;
   }
}



the Dclass has to have : extends AbsCmdReq implements Neuronable
in this case upon the input : say x y times
it will generat an algorithm with one alg part (APSay) and send it to the noiron.

the APclass extends AbsAlgPart. here it simply says x within each cycle.
it also uses a custom marker I added (at) to remember how many times it happend
so as to stop after y times.

permission levels :
after you've built your skill you need to place the Dclass into the Chobit class
as such :
Code:

private String doIt2(String ear, String eye) {
      // String axnStr = ""; //region 0
        inOut(detective, ear);
        inOut(dPermitter, ear);
        inOut(dRules, ear);
        inOut(dSpeller, ear);
      inOut(dAlarmer, "");
        if (dPermitter.getPermissionLevel() > 0) {
            // works with friends region 1
            inOut(dSayer, ear);
        }
        if (dPermitter.getPermissionLevel() > 1) {
            // only works with owner region 2
         inOut(dAlarmer, ear);
            inOut(dDirtyTalker, ear);
        }
        fusion.setAlgQueue(noiron);
      DCStrPair<String> result = new DCStrPair<String>();
      result = fusion.act(ear);
        this.emot = fusion.getEmot();
      return itemFilter(result);
region 0 : will run anyways
region 1 : requires lv1 permission : chobit name + input, for example :
chii say hi.
region 2 requires lv2 permission : chobit lv2 name + input, for example :
liron kiss me.

the lv2 name will be known only to the owner, while her lv1 name is her public
name used by friends and owner.

of course don't forget to declare the Dclass variable within the chobit class.

unique features:

female titan : fusion of algorithms :

the LG remembers how long an alg run time is. and so short enough algs can pause
a running much longer alg, run themselfs, then resume the big alg(time wize).
you can add custom logic to this if needed via the :
fuze(){} in the Fusion class.

armored titan : ability to mutate an alg part.

refer to the APMoan0 1 and 2 classes as an exampled implementation of this.
said moan classes dont do much they simply output a moan string.

APMoan0 sends an enumFail.fail (action function)if no input is received x number of times :
in other words the user isn't enjoying this moan set.

and so the mutation causes the AP to be replaced by a newly generated AP from here :

public AbsAlgPart mutation() {
// TODO Auto-generated method stub
APMoan0 mutant = new APMoan1();
int x = rand.nextInt(moanList.size() + 1);
switch (x) {
case 1:
mutant = new APMoan1();
break;
case 2:
mutant = new APMoan2();
break;
default:
break;
}
return (AbsAlgPart) mutant;
}

every AP has this method.

finally the mutate func of DExplorer determines what to do
according to the type of the AP the fail enum and the overall amount of times
said AP mutated. so as to not get stuck eventually the alg is rendered inActive :

Code:

if (failureCounter > 1) {
                        cera.setActive(false);
                    }

ape titan : the ability to use items and equipe external skills :

the logic to whether or not an AP should be equiped with an item is at the func :
public Boolean itemize() {}

next the GameShark class contains a list of available skills for each AP.
the active one is the one used.

the actual item is represented as a TER object

private String itemKey = "";
private String engageOn = "";// see item, eye string representation of the item
private String toFeel = ""; // how the item is grabed, empty string if virtual item.

refer to the TER func :
Code:

public DCStrPair<String> autoEngage(String str1) {
      // send image to grab + grab part
      // or what happens at condition x
      DCStrPair<String> result = new DCStrPair<>();
      if (str1.contains(engageOn) && !engageOn.equals("")) {
         result.key = FEEL; // when you see the item grab it.
         result.value = toFeel;
         return result;
      }
      result.key = this.itemKey;
      result.value = str1;
      return result;
   }

megata titan : dormant algorithms and its revival.
refer to DAlarmer and APCldAlarm for an example of an alarm clock using
this ability.
each Mcode or item has an equip algorithm (get the item, or declare it is equiped for
virtual items or do nothing)

an AP class as such uses a cloudian object and should be named with APCldSomething.

*******************************************************************************************

extras :

the emot function of the chobit class links the AP running to an emotion
so this should be linked to graphics.

refer to classes javadoc for more info.

ideally the A.G.I shoulld be running offline, so preffer local device databases
over online ones, to keep the A.G.I "enjoyable".

***************************************************************************************

examples of skills that need to be added :

auto programming : given task, outputs code project

titam level skill (war hammer titan): go home : when on stand by (finished doing stuff) and
outside, go home but 1st collect items used. fix or upgrade part of item.

add vision input compatibility : visual data -> to string, add eye field to Dclasses
and handle at AP classes. this fields can carry touch and other data strings.

limitless options really.

**************************************************************************************************

currently available conjurations :

copyrights moti barski

AP classes : extend the AbsAlgPart
those classes encapsulate the actual action or skill
APCuss : will cuss using the same word while the cause of the cuss is detected

APDirtyTalk : dirty talks with the user
conjuratis : "ok next" finishes the AP
c'tor : APDirtyTalk(Hashtable<String, String> hashtable)
gets a dirty talk DB as a dictionary. *that must start with "start"
further dev recommended : output filter : I U we they convert to U I and so on
advanced ver will learn new scripts, using vision and other techniques

APMoan : this is the moaning stage that comes after the dirty talk forplay AP in the algorithm.
a rather primitive moan system with preset moans :
moan0 to 2 = default moans, IMoan1 to 3 = moans when doll moved
thank you moan : finisher groan
private void playMoan(String input) {
is responsible for working the moan * could do this async

APSay : say x, y times

APSleep0 : sleeps : activates the private void sleep of the chobit class

APSleep : simulates sleep, until wake time or special wake input was inputed
*such input must undergo translation (noise = "wake up")and an if code line in the action function.

APSpell : can activate without permission(chobit name or hidden name)
such as telling times

D classes : extends the AbsCmdReq

this classes summon the AP classes using conjuratis(regex)

DDirtyTalker : dirty talk *
replace * with fuck
or program more options instead of *

Detective : this is a special DClass it doesn't use conjuratis
it is triggered by danger and negativity :
cussing
repeated input
too much requests
need to add : damage : body, friends, property, * time(cerabellum time out)

DPermitter : checks for the chobit name or lv 2 name before sending
a request to the other Dclasses.
sexy classes would require lv2 name
conjuratis :
change pass : oldPass new password newPassword change lv1 name :
pass your name is newName change lv2 name : pass you are newName

DRules : scheduled continuoes sync actions
contains sleep summon triggered by time

DSayer : says stuff
say x # times or say x

chobit : see class

**************************************************************************************************
classes :

_________________
MB over and out emp it up
Back to top Go down
Moti Barski
super
super
Moti Barski

Posts : 395
Join date : 2011-08-02

beyond omega level coding Empty
PostSubject: AbsAlgPart class   beyond omega level coding EmptyFri May 17, 2019 7:46 pm

I moti barski do not allow anyone and or anybody and or any organization to
receive monetary profit from this living grimoire unless writtenly approved by me personally.
you can use this for research.

name of the software : living grimoire : LG for short

Code:
public abstract class AbsAlgPart {
 // one part of an algorithm, it is a basic simple action or sub goal
    public abstract String action(String input); // return action string
 public abstract Boolean itemize(); // equip with item ?
    public abstract enumFail failure(String input); // failure type
    public abstract Boolean completed(); // has finished ?
    public abstract AbsAlgPart clone();
}


AbsCmdReq class :

Code:
public abstract class AbsCmdReq implements Neuronable {
 // handle the input per Dclass (a class whose name starts with D)
    public abstract void input(String command);
}

Algorithm class :

Code:
import java.util.ArrayList;

// a step by step plan to achieve a goal
public class Algorithm implements Comparable<Algorithm> {
    private String goal;
    private String representation;
    private ArrayList<AbsAlgPart> algParts = new ArrayList<>();

    public Algorithm(String goal, String representation, ArrayList<AbsAlgPart> algParts) {
        super();
        this.goal = goal;
        this.representation = representation;
        this.algParts = algParts;
    }
 // *constract with string and goal

    public String getGoal() {
        return goal;
    }

    public String getRepresentation() {
        return representation;
    }

    public ArrayList<AbsAlgPart> getAlgParts() {
        return algParts;
    }

    public int getSize() {
        return algParts.size();
    }

    public Algorithm clone() {
        ArrayList<AbsAlgPart> parts = new ArrayList<>();
        for (AbsAlgPart absAlgPart : this.algParts) {
            parts.add(absAlgPart.clone());
        }
        return new Algorithm(this.goal, getRepresentation(), parts);
    }

    @Override
    public int compareTo(Algorithm o) {
        // TODO Auto-generated method stub
        return 0;
    }
}

APCldAlarm class :

Code:
/*
 * megata kyoujin skill
 * this beauty is an alarm skill
 * it has the ability to go dormant and to get revived when needed
 * by using triggers : eye ear or time.
*/
public class APCldAlarm extends AbsAlgPart {
   private Cloudian cld;
   private Boolean isComplete = false;
   private enumFail enumfail = enumFail.ok;
   private String zman = "";

   public APCldAlarm(Cloudian cld, String zman) {
      super();
      this.cld = cld;
      this.zman = zman;
      this.cld.setActive(true);
      cld.setMe(4, "ok", "zhakhrix", zman);
   }

   public APCldAlarm(Cloudian cld, String zman, Boolean b1) {
      super();
      this.cld = cld;
      this.zman = zman;
   }

   @Override
   public String action(String input) {
      // TODO Auto-generated method stub
      String result = "";
      if (cld.getFin()) {
         result = "bwahaha";
         isComplete = true;
         cld.reset();
      }
      else if (!cld.getDead()) {
         switch (cld.getCountDown()) {
            case 4:
               result = "ok";
               cld.sleep(0);
               break;
         case 3:
            result = "wake up";
            cld.sleep(2);
            break;
         case 2:
            result = "come on wake up";
            cld.sleep(2);
            break;
         case 1:
            result = "please my darling do wake up";
            cld.sleep(2);
            break;
         default:
            result = "wake up I command you";
            cld.sleep(2);
            break;
         }
         //cld.sleep(2);
         enumfail = enumfail.cloudian;
         cld.setActive(false);
      } else {
         result = "it can not be helped";
         isComplete = true;
         cld.reset();
      }
      
      return result;
   }

   @Override
   public Boolean itemize() {
      // TODO Auto-generated method stub
      return false;
   }

   @Override
   public enumFail failure(String input) {
      // TODO Auto-generated method stub
      return this.enumfail;
   }

   @Override
   public Boolean completed() {
      // TODO Auto-generated method stub
      return this.isComplete;
   }

   @Override
   public AbsAlgPart clone() {
      // TODO Auto-generated method stub
      return new APCldAlarm(this.cld, this.zman, null);
   }

}
 Very Happy

_________________
MB over and out emp it up
Back to top Go down
Moti Barski
super
super
Moti Barski

Posts : 395
Join date : 2011-08-02

beyond omega level coding Empty
PostSubject: APCuss class   beyond omega level coding EmptyFri May 17, 2019 7:49 pm

I moti barski do not allow anyone and or anybody and or any organization to
receive monetary profit from this living grimoire unless writtenly approved by me personally.
you can use this for research.

name of the software : living grimoire : LG for short

APCuss class :

Code:

// a simple cuss action
public class APCuss extends AbsAlgPart {
    private int doer = 1;
   private String cuss, evil; // evil = the trigger of the anger
   // as long as evil exists the cussing goes on.
    private Boolean isComplete = false;

    public APCuss(String cuss, String evil) {
        super();
        this.cuss = cuss;
        this.evil = evil;
    }

    @Override
    public String action(String input) {
        String axnStr = "";
        if (doer < 10) {
            axnStr = evil;
            doer++;
        } else {
            doer = 0;
        }
        if (doer == 0 && evil != input) {
            isComplete = true;
        }
        return axnStr;
    }

    @Override
    public enumFail failure(String input) {
        // TODO Auto-generated method stub
        return enumFail.ok;
    }

    @Override
    public Boolean completed() {
        // TODO Auto-generated method stub
        return this.isComplete;
    }

    @Override
    public AbsAlgPart clone() {
        // TODO Auto-generated method stub
        return new APCuss(cuss, evil);
    }

   @Override
   public Boolean itemize() {
      // TODO Auto-generated method stub
      return false;
   }

}

APDirtyTalk class :

Code:


import java.util.Hashtable;

// dirty talk
public class APDirtyTalk extends AbsAlgPart {
   private Hashtable<String, String> hashtable = new Hashtable<>(); // script for dirty talking
    private String indexConvo = "start";
    private String kowase = "ok next";
    private Boolean isCompleted = false;

    @Override

    public String action(String input) {
        // TODO Auto-generated method stub
        String axnStr = "";
        if (input.equals(kowase)) {
            isCompleted = true;
        } else if (hashtable.containsKey(input)) {
            indexConvo = input;
            axnStr = hashtable.get(indexConvo);
        } else if (hashtable.containsKey(indexConvo)) {
            indexConvo = hashtable.get(indexConvo);
            axnStr = indexConvo;
        } else {
            isCompleted = true;
        }
        return axnStr;
    }

    public APDirtyTalk(Hashtable<String, String> hashtable) {
        super();
        this.hashtable = hashtable;
    }

    @Override
    public enumFail failure(String input) {
        // TODO Auto-generated method stub
        return enumFail.ok;
    }

    @Override
    public Boolean completed() {
        // TODO Auto-generated method stub
        return isCompleted;
    }

    @Override
    public AbsAlgPart clone() {
        // TODO Auto-generated method stub
        return new APDirtyTalk((Hashtable) this.hashtable.clone());
    }

   @Override
   public Boolean itemize() {
      // TODO Auto-generated method stub
      return false;
   }

}

APMoan class :

Code:
package PKGsystemClasses;

import java.util.ArrayList;
import java.util.Random;

public class APMoan extends AbsAlgPart {
   // TODO : create active fuck counter parameter for this class :-)
   // this class is responsible to trigger the right moan
   private ArrayList<String> moans; // automatic moan :
   /*
    * such as : come on lets fuck please oh me so horney
    */
   private ArrayList<String> interActiveMoans;
   /*
    * this will link to inter active convo like moans such as : fuck yeah feels
    * good ahhhhh weeeeee all moans must be linked to actual audio
    */
   private Boolean isCompleted = false; // the user has jizzed 8)
   private PlayGround watch; // used to get seconds here
   // I want a pause between moans so it looks like the app needs to breath
   private boolean Acted;
   private String todo = "";

   public APMoan() {
      // c'tor
      super();
      watch = new PlayGround();
      Acted = false;
      this.moans = new ArrayList<>();
      this.interActiveMoans = new ArrayList<>();
      moans.add("moan0");// example moans (more can be added)
      moans.add("moan1");
      moans.add("moan2");

      interActiveMoans.add("IMoan1"); // inter active moans (doll was moved) or told something
      interActiveMoans.add("IMoan2");
      interActiveMoans.add("IMoan3");

      moans.add("thank you"); // user jizzed (conclusion after fuck)

   }

   @Override
   public String action(String input) {
      // where the actual action takes place (the meat of this class)
      // the sysout is a temporary methode stub
      String axnStr = "";
      if (input.equals("thank you") || this.interActiveMoans.contains(input)) {
         this.todo = input;
      }
      int sec = watch.getSecondsAsInt(); // will be commented out
      // axnStr = sec + "";
      if (!this.Acted) {
         // (time div (moan duration + extra tolerance time)) mod 2 == 0
         if ((sec / 10) % 2 == 0) {
            Acted = true;
            if (this.equals("thank you")) {
               playMoan("finish");
               this.isCompleted = true;
               this.todo = "";
               return axnStr;
            }
            if (interActiveMoans.contains(this.todo)) {
               playMoan(this.todo);
               this.todo = "";
               return axnStr;
            }
            Random rand = new Random();
            int x = rand.nextInt(moans.size() - 1);

            playMoan("moan num " + x);
            // Acted = true;
         }
      } else {
         this.Acted = false;
      }
      return axnStr;
   }

   private void playMoan(String input) {
      // TODO Auto-generated method stub
      // System.out.println(input);

   }

   @Override
   public String failure(String input) {
      // TODO Auto-generated method stub
      return null;
   }

   @Override
   public Boolean completed() {
      // TODO Auto-generated method stub
      return isCompleted;
   }

   @Override
   public AbsAlgPart clone() {
      // TODO Auto-generated method stub
      return new APMoan();
   }

}

APMoan0 class :

Code:


import java.util.ArrayList;
import java.util.Random;

public class APMoan0 extends AbsAlgPart implements Mutatable {
    protected Random rand = new Random();
    protected final int failed = 3;
    protected enumFail failure = enumFail.ok;
    protected boolean isComplete = false;
    protected ArrayList<String> interactions;
    protected ArrayList<String> moans;
    protected ArrayList<String> groans;
    protected ArrayList<String> moanList;
    protected int noInputCounter = 0;

    public APMoan0() {
        super();
        moanList = new ArrayList<>();
        moanList.add("1");
        moanList.add("2");
        interactions = new ArrayList<>();
        moans = new ArrayList<>();
        groans = new ArrayList<>();
    }

    @Override
    public AbsAlgPart mutation() {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public String action(String input) {
        if (!input.equals("")) {
            noInputCounter = 0;
        }
        if (input.contains("thank you")) {
            isComplete = true;
            return "fuck you very much";
        }
        if (input.equals("")) {
            noInputCounter++;
            if (noInputCounter > failed) {
                failure = enumFail.fail;
            }
        } //
        else if (interactions.contains(input)) {
            return moans.get(rand.nextInt(moans.size()));
        }
        return groans.get(rand.nextInt(groans.size()));
    }

    @Override
    public enumFail failure(String input) {
        // TODO Auto-generated method stub
        return this.failure;
    }

    @Override
    public Boolean completed() {
        // TODO Auto-generated method stub
        return isComplete;
    }

    @Override
    public AbsAlgPart clone() {
        // TODO Auto-generated method stub
        return null;
    }

   @Override
   public Boolean itemize() {
      // TODO Auto-generated method stub
      return false;
   }

}

APMoan1 class :

Code:


public class APMoan1 extends APMoan0 {

    public APMoan1() {
        super();
        interactions.add("do it");
        moans.add("fuck");
        moans.add("fuck yeah");
        groans.add("i love you");
        groans.add("sweet");
    }

    @Override
    public AbsAlgPart clone() {
        // TODO Auto-generated method stub
        return new APMoan1();
    }

    @Override
    public AbsAlgPart mutation() {
        // TODO Auto-generated method stub
        APMoan0 mutant = new APMoan1();
        int x = rand.nextInt(moanList.size() + 1);
        switch (x) {
            case 1:
                mutant = new APMoan1();
                break;
            case 2:
                mutant = new APMoan2();
                break;
            default:
                break;
        }
        return (AbsAlgPart) mutant;
    }
}


APMoan2 class :

Code:



public class APMoan2 extends APMoan0 {

    public APMoan2() {
        super();
        interactions.add("do it");
        moans.add("lick it");
        moans.add("harder");
        groans.add("i heart you");
        groans.add("dear");
    }

    @Override
    public AbsAlgPart clone() {
        // TODO Auto-generated method stub
        return new APMoan2();
    }

    @Override
    public AbsAlgPart mutation() {
        // TODO Auto-generated method stub
        APMoan0 mutant = new APMoan1();
        switch (rand.nextInt(moanList.size() - 1)) {
            case 1:
                mutant = new APMoan1();
                break;
            case 2:
                mutant = new APMoan2();
                break;
            default:
                break;
        }
        return mutant;
    }
}

Very Happy

_________________
MB over and out emp it up
Back to top Go down
Moti Barski
super
super
Moti Barski

Posts : 395
Join date : 2011-08-02

beyond omega level coding Empty
PostSubject: APSay class   beyond omega level coding EmptyFri May 17, 2019 7:52 pm

I moti barski do not allow anyone and or anybody and or any organization to
receive monetary profit from this living grimoire unless writtenly approved by me personally.
you can use this for research.

name of the software : living grimoire : LG for short

APSay class :

Code:

/* it speaks something x times
 * a most basic skill.
 * also fun to make the chobit say what you want
 * */
public class APSay extends AbsAlgPart {
    protected String param;
    private int at;

    public APSay(int at, String param) {
        super();
        if (at > 10) {
            at = 10;
        }
        this.at = at;
        this.param = param;
    }

    @Override
    public String action(String input) {
        // TODO Auto-generated method stub
        String axnStr = "";
        if (this.at > 0) {
            if (!input.equalsIgnoreCase(param)) {
                axnStr = param;
                at--;
            }
        }
        return axnStr;
    }

    @Override
    public enumFail failure(String input) {
        // TODO Auto-generated method stub
        return enumFail.ok;
    }

    @Override
    public Boolean completed() {
        // TODO Auto-generated method stub
        return at < 1;
    }

    @Override
    public AbsAlgPart clone() {
        // TODO Auto-generated method stub
        return new APSay(this.at, this.param);
    }

   @Override
   public Boolean itemize() {
      // TODO add logic
      // at home
      return true;
   }
}

APSleep class :

Code:

/* doesn't actually does anything
 * she simply sleeps
 * till she gets a wake string or the time to wake comes
 * */
public class APSleep extends AbsAlgPart {
    // waker = wake
    private PlayGround playGround = new PlayGround();
    private int wakeTime; // hour

    public void setWakeTime(int wakeTime) {
        this.wakeTime = wakeTime;
    }

    private Boolean isComplete = false;

    public APSleep(int wakeTime) {
        super();
        this.wakeTime = wakeTime;
    }

    @Override
    public String action(String input) {
        // TODO Auto-generated method stub
        String axnStr = "";
        if (this.isComplete) {
            return axnStr;
        }
        if ((wakeTime == playGround.getHoursAsInt()) || (input.contains("wake"))) {
            isComplete = true;
            axnStr = "waking";
            return axnStr;
        }
        if (!input.isEmpty()) {
            axnStr = "sleeping";
        }
        return axnStr;
    }

    public int getWakeTime() {
        return wakeTime;
    }

    @Override
    public enumFail failure(String input) {
        // TODO Auto-generated method stub
        return enumFail.ok;
    }

    @Override
    public Boolean completed() {
        // TODO Auto-generated method stub
        return this.isComplete;
    }

    @Override
    public AbsAlgPart clone() {
        // TODO Auto-generated method stub
        return new APSleep(this.wakeTime);
    }

   @Override
   public Boolean itemize() {
      // TODO Auto-generated method stub
      return false;
   }

}

APSleep0 class :

Code:

/* activate the nemure action
 * of the chobit class
 * where the saving and loading of data against a data base should be
 * */
public class APSleep0 extends AbsAlgPart {
    private Boolean isComplete = false;
    private Chobit.InnerClass actualSleep;

    @Override
    public String action(String input) {
        String puke;
        puke = this.actualSleep.nemure();
        isComplete = true;
        return puke;
    }

    public APSleep0(Chobit.InnerClass actualSleep) {
        super();
        this.actualSleep = actualSleep;
    }

    @Override
    public enumFail failure(String input) {
        // TODO Auto-generated method stub
        return enumFail.ok;
    }

    @Override
    public Boolean completed() {
        // TODO Auto-generated method stub
        return isComplete;
    }

    @Override
    public AbsAlgPart clone() {
        // TODO Auto-generated method stub
        return new APSleep0(this.actualSleep);
    }

   @Override
   public Boolean itemize() {
      // TODO Auto-generated method stub
      return false;
   }

}

APSpell class:

Code:

/* an easy way to add an action to any exact input
 * */
public class APSpell extends AbsAlgPart {
    PlayGround playGround = new PlayGround();
    String[] morningGreet = { "good morning", "hi", "hadouken", "]" };
    private String param = "";
    private Boolean isCompleted = false;
    public APSpell(String param) {
        super();
        this.param = param;
    }

    private String greet() {
        String axnStr = "";
        int random = (int) (Math.random() * 20);
        if ((random < morningGreet.length - 1) && (random != 0)) {
            axnStr = morningGreet[0] + " " + morningGreet[random];
            String temp = morningGreet[0];
            morningGreet[0] = morningGreet[random];
            morningGreet[random] = temp;
        } else {
            axnStr = morningGreet[0];
        }
        return axnStr;
    }

    @Override
    public String action(String input) {
        String axnStr = "";
        switch (this.param) {
            case "what is the time":
                axnStr = playGround.getCurrentTimeStamp();
                break;
            case "what is the date":
                axnStr = playGround.getSpecificTime(enumTimes.DATE);
                break;
            case "what is the year":
                axnStr = playGround.getSpecificTime(enumTimes.YEAR);
                break;
            case "current seconds":
                axnStr = playGround.getSpecificTime(enumTimes.SECONDS);
                break;
            case "current minutes":
                axnStr = playGround.getSpecificTime(enumTimes.MINUTES);
                break;
            case "current hour":
                axnStr = playGround.getSpecificTime(enumTimes.HOUR);
                break;
            case "which day is it":
                axnStr = playGround.getDayOfDWeek();
                break;
            case "greet":
                axnStr = greet();
                break;
            default:
                break;

        }
        isCompleted = true;
        return axnStr;
    }

    @Override
    public enumFail failure(String input) {
        // TODO Auto-generated method stub
        return enumFail.ok;
    }

    @Override
    public Boolean completed() {
        // TODO Auto-generated method stub
        return isCompleted;
    }

    @Override
    public AbsAlgPart clone() {
        // TODO Auto-generated method stub

        return new APSpell(this.param);
    }

   @Override
   public Boolean itemize() {
      // TODO Auto-generated method stub
      return false;
   }
}

APSummonSkill class :

Code:
/*a temp skill not vital really
 * it simply marks that an item has been equiped
 * it is a copy paste of the APSay skill
 * */
public class APSummonSkill extends AbsAlgPart {
   protected String param;
   private int at;

   public APSummonSkill(int at, String param) {
      super();
      if (at > 10) {
         at = 10;
      }
      this.at = at;
      this.param = param;
   }

   @Override
   public String action(String input) {
      // TODO Auto-generated method stub
      String axnStr = "";
      if (this.at > 0) {
         if (!input.equalsIgnoreCase(param)) {
            axnStr = param;
            at--;
         }
      }
      return axnStr;
   }

   @Override
   public enumFail failure(String input) {
      // TODO Auto-generated method stub
      return enumFail.ok;
   }

   @Override
   public Boolean completed() {
      // TODO Auto-generated method stub
      return at < 1;
   }

   @Override
   public AbsAlgPart clone() {
      // TODO Auto-generated method stub
      return new APSay(this.at, this.param);
   }

   @Override
   public Boolean itemize() {
      // TODO add logic
      // at home
      return false;
   }
}

BlockTime class :

Code:

/*becomes false for 5 minutes from the setBlock time
 * */
public class BlockTime {
    private int h = -1;
    private int m = -1;
    private int blockMinutes = 5;

    public void setBlock(int hour, int minutes) {
        this.m = minutes + blockMinutes;
        this.h = hour;
        if (m > 60) {
            m -= 60;
            h += 1;
            if (h > 24) {
                h -= 24;
            }
        }
    }

    public Boolean unBlock(int hour, int minutes) {
        if (h == -1) {
            return false;
        }
        if ((hour == this.h) && (minutes > this.m)) {
            h = -1;
            m = -1;
            return false;
        }
        return true;
    }
}
Very Happy

_________________
MB over and out emp it up
Back to top Go down
Moti Barski
super
super
Moti Barski

Posts : 395
Join date : 2011-08-02

beyond omega level coding Empty
PostSubject: Cerabellum class   beyond omega level coding EmptyFri May 17, 2019 7:56 pm

I moti barski do not allow anyone and or anybody and or any organization to
receive monetary profit from this living grimoire unless writtenly approved by me personally.
you can use this for research.

name of the software : living grimoire : LG for short

Cerabellum class:

Code:


public class Cerabellum {
    // runs an algorithm
    private int fin;
    private int at;
    private enumFail failType;
   private Boolean incrementAt = false;

   public void advanceInAlg() {
      if (incrementAt) {
         incrementAt = false;
         at++;
         if (at == fin) {
            isActive = false;
         }
      }
   }

    public int getAt() {
        return at;
    }

    public Algorithm alg;
    private boolean isActive = false;
    private String emot = "";

    public String getEmot() {
        return emot;
    }
    public boolean setAlgorithm(Algorithm algorithm) {
      if (!isActive && (algorithm.getAlgParts() != null)) {
            this.alg = algorithm;
            this.at = 0;
            this.fin = algorithm.getSize();
            this.isActive = true;
            this.emot = alg.getAlgParts().get(at).getClass().getSimpleName(); // updated line
            return false;
        }
        return true;
    }

    public boolean isActive() {
        return isActive;
    }

   public boolean setActive(Boolean b1) {
      return isActive = b1;
   }
    public void setActive(boolean isActive) {
        this.isActive = isActive;
    }
    public String act(String input) {
        String axnStr = "";
        if (!isActive) {
            return axnStr;
        }
        if (at < fin) {
            axnStr = alg.getAlgParts().get(at).action(input);
            this.emot = alg.getAlgParts().get(at).getClass().getSimpleName();
            if (alg.getAlgParts().get(at).completed()) {
            incrementAt = true;
            // at++;
            // if (at == fin) {
            // isActive = false;
            // }
            }
        }
        return axnStr;
    }

    public enumFail getFailType() {
        return alg.getAlgParts().get(at).failure("");
    }
}

Chobit class :

Code:
import java.util.Hashtable;

public class Chobit {
   private String emot = ""; // emotion
    // algorithms fusion (polymarization)
   private Hashtable<String, Integer> AlgDurations = new Hashtable<>();
   private Fusion fusion = new Fusion(AlgDurations);
    //region DClasses
    private Permission permission = Permission.newInstance("xxx", "chii", "liron");
    private DPermitter dPermitter = new DPermitter(permission);
    private Detective detective = new Detective(fusion);
    private DSpeller dSpeller = new DSpeller();
    private DSayer dSayer = new DSayer();
   private DAlarmer dAlarmer = new DAlarmer();
    private DDirtyTalker dDirtyTalker = new DDirtyTalker();
    //endregion
    private Neuron noiron;
    // sleep vars :
    private InnerClass inner;
    private DRules dRules;
   private DCFilter dcFilter = new DCFilter(); // used for the filter func
   private Person activePerson = new Person();
   private PrimoCera primoCera = new PrimoCera();
    public Chobit() {
        super();
        noiron = new Neuron();
        this.inner = new InnerClass(); // sleep var
        dRules = new DRules(new APSleep(24), inner);
    }

   private String doIt2(String ear, String eye) {
      // this is the main function
      // works regardless of permissions
        inOut(detective, ear);
        inOut(dPermitter, ear);
        inOut(dRules, ear);
        inOut(dSpeller, ear);
      inOut(dAlarmer, "");
        if (dPermitter.getPermissionLevel() > 0) {
            // works with friends
            inOut(dSayer, ear);
        }
        if (dPermitter.getPermissionLevel() > 1) {
            // only works with owner
         inOut(dAlarmer, ear);
            inOut(dDirtyTalker, ear);
        }
        fusion.setAlgQueue(noiron);
      DCStrPair<String> result = new DCStrPair<String>();
      result = fusion.act(ear);
        this.emot = fusion.getEmot();
      return itemFilter(result);
    }

    public String getEmot() {
      // emot (emotion for display)
        String x1 = emot;
        switch (this.emot) {
            case "APCuss ":
                x1 = "angry";
                break;
            case "APDirtyTalk":
                x1 = "grinny";
                break;
            case "APMoan":
                x1 = "horny";
                break;
            case "APSay":
                x1 = "speaking";
                break;
            case "APSleep0":
                x1 = "dreaming";
                break;
            case "APSleep":
                x1 = "asleep";
                break;
            case "APSpell":
                x1 = "blank";
                break;
            default:
                break;
        }
        emot = "";
        return x1;
    }

    private String sleep() {
      // data save load should go here and run while chobit is sleeping
        return "haha I can sleep !";
    }

    private void inOut(AbsCmdReq dClass, String stuff) {
        dClass.input(stuff); // new
        dClass.output(noiron);
    }

    protected class InnerClass {
        public String nemure() {
            return sleep();
        }
    }

   private String itemFilter(DCStrPair<String> pair) {
      if (!pair.key.equals(dcFilter.prevKey)) {
         // fold prev key(item) with switch case :
         // tie bike, put phone in place...
         // dcFilter.ignoreCounter = 3; // longer tick for longer action
      }
      // fold on key change;
      String result = "";
      // ter(item) cases
      switch (pair.key) {
      case "itemLess":
         result = pair.value;
         break;
      case "nyaa":
         if (!activePerson.getActive()) {
            // send SMS if target guy is not actively available/responding
         } else {
            result = pair.value + " nyaa";
         }
         dcFilter.imutable = true; // constant action (no need to try other movements)
         // * dcFilter.ignoreCounter = 3; // longer tick for longer action
      default:
         break;
      }
      return result;
   }

   public String doIt(String ear, String eye) {
      if (dcFilter.danger.contains(ear) || dcFilter.danger.contains(eye)) {
         return doIt2(ear, eye);
      }
      if (dcFilter.ignoreCounter > 0) {
         dcFilter.ignoreCounter--;
      } else if (dcFilter.imutable) {
         return doIt2(ear, eye);
      } else if (eye.contains(dcFilter.pair.toString())) {
         primoCera.saveAction(dcFilter.pair.toString(), dcFilter.actioNum);
         // savekeyvalnum (successful actual action chosen)
      } else {
         dcFilter.actioNum++;
         if (dcFilter.actioNum > primoCera.getFinalActionCode()) {
            dcFilter.actioNum = 0;
         }
         primoCera.saveAction(dcFilter.pair.toString(), dcFilter.actioNum);
         // save key++,num
         // the action did not result in the needed imidiate outcome, use a different
         // action next time
      }
      return doIt2(ear, eye);
   }
   private String translateIn() {
      return "";
   }

   private String translateOut() {
      return "";
   }
}

Cloudian class :

Code:

/*a trigger for reviving a dormant algorithm
 * there should be a cloudian per APCld (alg part cloudian user)
 * */
public class Cloudian {
   private Boolean active = false;
   private Algorithm algorithm = null;
   private String timeTrig = ""; // time trigger
   private String earTrig = "zhakhrixxer";
   private String eyeTrig = "zhakhrixxer";
   private int countDown = 0;
   private Boolean dead = false;

   public Boolean getDead() {
      return dead;
   }

   private Boolean fin = false;

   public Boolean getFin() {
      return fin;
   }

   private PlayGround playGround = new PlayGround();

   public Boolean updateStat(String ear, String eye) {
      Boolean result = false;
      if (ear.contains(earTrig) || eye.contains(eyeTrig)) {
         fin = true;
         result = true;
      }
      if (playGround.getCurrentTimeStamp().equals(this.timeTrig)) {
         result = true;
      }
      result = result && !active;
      if (result) {
         active = true;
      }
      return result;
   }

   public int getCountDown() {
      return countDown;
   }

   public void setCountDown(int countDown) {
      this.countDown = countDown;
   }

   public void reset() {
      active = false;
      algorithm = null;
      timeTrig = ""; // time trigger
      earTrig = "zhakhrixxer";
      eyeTrig = "zhakhrixxer";
      countDown = 0;
      dead = false;
      fin = false;
   }

   public void setMe(int count, String ear, String eye, String setAlmTo) {
      this.countDown = count;
      this.earTrig = ear;
      this.eyeTrig = eye;
      this.timeTrig = setAlmTo;
   }

   public void sleep(int dormantFor) {
      if (this.countDown > 0) {
         this.countDown--;
      } else {
         this.dead = true;
      }
      // this.timeTrig = playGround.getFutureInXMin(dormantFor);
      this.timeTrig = playGround.getFutureFromXInYMin(dormantFor, this.timeTrig);
   }
   public Boolean getActive() {
      return active;
   }

   public void setActive(Boolean active) {
      this.active = active;
   }

   public Algorithm getAlgorithm() {
      return algorithm;
   }

   public void setAlgorithm(Algorithm algorithm) {
      this.algorithm = algorithm;
   }

   public String getTimeTrig() {
      return timeTrig;
   }

   public void setTimeTrig(String timeTrig) {
      this.timeTrig = timeTrig;
   }

   public String getEarTrig() {
      return earTrig;
   }

   public void setEarTrig(String earTrig) {
      this.earTrig = earTrig;
   }

   public String getEyeTrig() {
      return eyeTrig;
   }

   public void setEyeTrig(String eyeTrig) {
      this.eyeTrig = eyeTrig;
   }

}

DAlarmer class:

Code:
import java.util.ArrayList;

/*creates algorithms with alg parts that can become dormant
 * can wake a dormant algorithm
 * should use notify if you add more cloudians to a wake one of many said algorithm
 * */
public class DAlarmer extends AbsCmdReq implements Neuronable {
   private RegexUtil regexUtil = new RegexUtil();
   private String jikan = "";
   private Cloudian cloudian = new Cloudian();
   private String representation = "";
   private Boolean summon = false;
   private String ear = "";

   @Override
   public void output(Neuron noiron) {
      // TODO Auto-generated method stub
      if (summon) {
         // AbsAlgPart itte = new APCldAlarm(cloudian, jikan);
         AbsAlgPart itte = new APCldAlarm(cloudian, jikan);
         ArrayList<AbsAlgPart> algParts1 = new ArrayList<>();
         algParts1.add(itte);
         Algorithm algorithm = new Algorithm("alm", representation, algParts1);
         this.cloudian.setAlgorithm(algorithm); // ***
         noiron.algParts.add(algorithm);
         reset();
         return;
      }
      if (this.cloudian.updateStat(ear, "")) {
         noiron.algParts.add(this.cloudian.getAlgorithm());
      }
   }

   private void reset() {
      representation = "";
      summon = false;
   }

   @Override
   public void input(String command) {
      // TODO Auto-generated method stub
      this.ear = command;
      jikan = regexUtil.regexChecker("\\d+:\\d+", command);
      if (command.contains("wake me at") && !jikan.isEmpty()) {
         summon = true;
         representation = command;
      }
   }

}

DCFilter class :

Code:
import java.util.HashSet;

// data class (DC). just a variable.
public class DCFilter {
   public HashSet<String> danger = new HashSet<>();
   public Boolean imutable = true;
   public String prevKey = "";
   public int ignoreCounter = 0;
   public DCStrPair<String> pair = new DCStrPair<>();;
   public int actioNum = 0;

   public DCFilter() {
      super();
      this.pair.key = "";
      this.pair.value = "";
   }

}

DCStrPair<T> class:

Code:
// data class.
public class DCStrPair<T> {
   public T key;
   public T value;

   @Override
   public String toString() {
      // TODO Auto-generated method stub
      return (String) key + (String) value;
   }
}

Very Happy

_________________
MB over and out emp it up
Back to top Go down
Moti Barski
super
super
Moti Barski

Posts : 395
Join date : 2011-08-02

beyond omega level coding Empty
PostSubject: DDirtyTalker class   beyond omega level coding EmptyFri May 17, 2019 7:59 pm

I moti barski do not allow anyone and or anybody and or any organization to
receive monetary profit from this living grimoire unless writtenly approved by me personally.
you can use this for research.

name of the software : living grimoire : LG for short

DDirtyTalker class :

Code:


import java.util.ArrayList;

// generates an algorithm with dirty talking and then moaning too.
public class DDirtyTalker extends AbsCmdReq implements Neuronable {
    private String choice = "";
    ArrayList<String> choices = new ArrayList<>();

    public DDirtyTalker() {
        super();
        choices.add("fuck");
    }

    private String param;
    private RegexUtil regexUtil = new RegexUtil();
    private ArrayList<AbsAlgPart> algParts;
    private String represantation = "";
    @Override
    public void output(Neuron noiron) {
        // TODO Auto-generated method stub
        switch (choice) {
            case "fuck":
                APDirtyTalk apDirtyTalk = new APDirtyTalk(new MockDB().getHashtable());
                APMoan1 moan = new APMoan1(); // default
                algParts = new ArrayList<>();
                algParts.add(apDirtyTalk);
                algParts.add(moan);
                represantation = "dirty talk fuck";
                Algorithm algorithm = new Algorithm("fuck", represantation, algParts);
                noiron.algParts.add(algorithm);
                this.choice = "";
                break;

            default:
                break;
        }
    }

    @Override
    public void input(String command) {
        // TODO Auto-generated method stub
        // regex here
        String param = regexUtil.regexChecker("(?<=dirty talk)(.*)", command);
        if (choices.contains(param)) {
            choice = param;
        }

    }

}

Detective class :

Code:


import java.util.ArrayList;

/*handles dager type input :
 * pain, repeated input, cussing, danger
 * */
public class Detective extends AbsCmdReq implements Neuronable {
    private String mimi, prevMimi; // ear input
    private int cussCounter; // must be > cussing action
    private String cry;
    private String imBusy;
    private String requestRepeated;
    private ArrayList<String> cusses = new ArrayList<String>();
    private Fusion fusion;

    public Detective(Fusion fusion) {
        super();
        this.fusion = fusion;
        this.mimi = "";
        this.prevMimi = "";
        this.imBusy = "chill";
        this.requestRepeated = "fineeeeeeeeeeeeeeeeeeeeeee";
        this.cry = "hadouken";
        this.cussCounter = 0;
        cusses.add("shit");
        cusses.add("fuck");
        cusses.add("jizz");
        cusses.add("");
        cusses.add(cry);
    }

    @Override
    public void output(Neuron noiron) {
        // TODO Auto-generated method stub
        if (cussCounter > 3) {
            cussCounter = 0;
            noiron.negativeAlgParts.add(loadCuss());
            return;
        }
        if (fusion.getReqOverload()) {
            badReqConditions(this.imBusy, noiron);
            return;
        }
        if (fusion.getRepReq()) {
            badReqConditions(this.requestRepeated, noiron);
            // System.out.println("again with this shit ? :");
        }
    }

    @Override
    public void input(String ear) {
        // TODO Auto-generated method stub
        this.mimi = ear;
        if ((this.mimi.equals(this.prevMimi)  || this.cusses.contains(this.mimi)) && !this.mimi.isEmpty()) {
            // || this.cusses.contains(this.mimi) enables old cuss recognition without
            // repetition
            this.cussCounter++;
            if (!cusses.contains(mimi)) {
                cusses.set((int) (Math.random() * 3 + 1) - 1, mimi);
            }
        }
        this.prevMimi = mimi;
    }

    private Algorithm loadCuss() {
        APCuss apCuss = new APCuss(cry, cusses.get((int) (Math.random() * cusses.size() + 1) - 1));
        ArrayList<AbsAlgPart> algParts = new ArrayList<>();
        algParts.add(apCuss);
        String represantation = "cuss"; // *match
        Algorithm algorithm = new Algorithm("cuss", represantation, algParts);
        return algorithm;
    }

    private Algorithm loadReplay(String replay) {
        APSay apCuss = new APSay(1, replay);
        ArrayList<AbsAlgPart> algParts = new ArrayList<>();
        algParts.add(apCuss);
        String represantation = "say " + replay; // *match
        Algorithm algorithm = new Algorithm("say", represantation, algParts);
        return algorithm;
    }

    private void badReqConditions(String replay, Neuron noiron) {
        int actionX = (int) (Math.random() * 2 + 1) - 1;
        switch (actionX) {
            case 0:
                noiron.negativeAlgParts.add(loadCuss());
                break;
            default:
                noiron.negativeAlgParts.add(loadReplay(replay));
                break;
        }
    }
}

DExplorer class:

Code:
//D class responsible for exploring :
// learning, mutating algorithms, requiping APs with objects or skill mods
// the sould resides here

public class DExplorer extends AbsCmdReq implements Neuronable {
    private int failureCounter = 0;
    private String prevAP = "";
   public GameShark gameShark = new GameShark();
    @Override
    public void output(Neuron noiron) {
        // TODO Auto-generated method stub

    }

    @Override
    public void input(String command) {
        // TODO Auto-generated method stub

    }

   public void mutate(Cerabellum cera, enumFail failure) {
        String AP = cera.getEmot();
        // group
        AP = GroupAP(AP);
        // give up ? :
        if (prevAP.contains(AP) && !failure.toString().equals(enumFail.ok.toString())) {
            failureCounter++;
            switch (AP) {
                case "APSay":
                    break;
                case "APMoan":
                    if (failureCounter > 1) {
                        cera.setActive(false);
                    }
                    break;
                default:
                    break;
            }
        }
        else {
            if (!prevAP.contains(AP)) {
                failureCounter = 0;
            }
        }
        prevAP = AP;
        switch (failure) {
            case fail:
                Mutatable mutant = (Mutatable) cera.alg.getAlgParts().get(cera.getAt());
                cera.alg.getAlgParts().set(cera.getAt(), mutant.mutation());
                break;
      case requip:
         gameShark.outerMutate(AP);
         break;
      case cloudian:
         cera.setActive(false);
         break;
            default:
                break;
        }
    }

    private String GroupAP(String aP) {
        String result = "";
        if (aP.contains("APMoan")) {
            result = "APMoan";
        }
        return result;
    }

   public void requip(Cerabellum fusionCera, Cerabellum mainCera) {
      for (AbsAlgPart algPart : mainCera.alg.getAlgParts()) {
         if (algPart.itemize()) {
            this.gameShark.addMcode(algPart.getClass().getSimpleName());
         }
      }
      fusionCera.setAlgorithm(this.gameShark.requipAlg);
      this.gameShark.setGameShark();
   }
}

Dpermitter class :

Code:


import java.util.ArrayList;

/* handles permissions using 2 names for the chobit :
 * name one : permission lv1 (engages with friend)
 * name 2 : permission level2 (for doing things with the owner only)
 * */
public class DPermitter extends AbsCmdReq implements Neuronable {
    /*
    * conjuratis : change pass : oldPass new password newPassword change lv1 name :
    * pass your name is newName change lv2 name : pass you are newName
    */
    Permission permission;
    private int permissionLevel = 2;
    private int relevantCase = 0;
    private RegexUtil regexer = new RegexUtil();
    public DPermitter(Permission permission) {
        super();
        this.permission = permission;
    }

    @Override
    public void output(Neuron noiron) {
        switch (this.relevantCase) {
            case 1:
                requipSayAlg(noiron, permission.getLv1Name());
                break;
            case 2:
                requipSayAlg(noiron, "got it");
                break;
            case 3:
                requipSayAlg(noiron, "got it");
                break;
            case 4:
                requipSayAlg(noiron, "got it");
                break;
            default:
                break;
        }
        this.relevantCase = 0;
    }

    @Override
    public void input(String command) {
        permission.setPermissionLevel(command);
        this.permissionLevel = this.permission.getPermissionLevel();
        if (command.contains("what is your name")) {
            this.relevantCase = 1;
            return;
        }
        String password = regexer.regexChecker("(\\w+)(?= you are)", command);
        String newName = regexer.regexChecker("(?<=you are)(.*)", command);
        if (permission.setLv2Name(password, newName)) {
            this.relevantCase = 2;
            return;
        }
        ;
        password = regexer.regexChecker("(\\w+)(?= your name is)", command);
        newName = regexer.regexChecker("(?<=your name is)(.*)", command);
        if (permission.setLv1Name(password, newName)) {
            this.relevantCase = 3;
            return;
        }
        ;
        password = regexer.regexChecker("(\\w+)(?= new password)", command);
        newName = regexer.regexChecker("(?<=new password)(.*)", command);
        if (permission.setLv1Name(password, newName)) {
            this.relevantCase = 4;
            return;
        }
        ;
    }

    public int getPermissionLevel() {
        return permissionLevel;
    }

    private void requipSayAlg(Neuron noiron, String replay) {
        AbsAlgPart itte = new APSay(1, replay);
        ArrayList<AbsAlgPart> algParts1 = new ArrayList<>();
        algParts1.add(itte);
        String represantation = "say " + replay;
        Algorithm algorithm = new Algorithm("say", represantation, algParts1);
        noiron.algParts.add(algorithm);
    }
}

DRules

Code:


import java.util.ArrayList;
import java.util.Hashtable;

public class DRules extends AbsCmdReq implements Neuronable {
    // sends a sleepgorithm out. triggered at sleep hour.
    private AbsAlgPart apSleep;
    private PlayGround playGround = new PlayGround();
    private Hashtable<String, String> zettaiRules = new Hashtable<>();
    private BlockTime blockTime = new BlockTime();
    private String todo = "";
    // private int sleepMinute = 0;
    private Chobit.InnerClass actualSleep;

    public DRules(APSleep apSleep, Chobit.InnerClass actualSleep) {
        super();
        this.apSleep = apSleep;
        int sleepTime = apSleep.getWakeTime() - 2;
        if (sleepTime > 24) {
            sleepTime -= 24;
        }
        zettaiRules.put(sleepTime + ":00", "sleep");
        this.actualSleep = actualSleep;
        // can add 01 02 minutes
        // this.sleepHour = sleepHour;
    }

    @Override
    public void output(Neuron noiron) {
        switch (todo) {
            case "sleep":
                ArrayList<AbsAlgPart> algParts1 = new ArrayList<>();
                APSleep0 apSleep0 = new APSleep0(actualSleep);
                algParts1.add(apSleep0);
                algParts1.add(this.apSleep);
                Algorithm algorithm = new Algorithm("sleep", "going to sleep", algParts1);
                noiron.algParts.add(algorithm);
                break;

            default:
                break;
        }
    }

    @Override
    public void input(String command) {
        // TODO Auto-generated method stub
        int h = playGround.getHoursAsInt();
        int m = playGround.getMinutesAsInt();
        String strH = (h < 10) ? "0" + h : h + "";
        String strM = (m < 10) ? "0" + m : m + "";
        ;
        String Time = strH + ":" + strM;
        // zettaiRules.put(Time, "sleep"); // for testing
        Boolean boolean1 = zettaiRules.containsKey(Time);
        if ((!blockTime.unBlock(h, m)) && boolean1) {
            todo = zettaiRules.get(Time);
            blockTime.setBlock(h, m);
        }
    }
}

DSayer :

Code:


import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

// very simple Dclass for creating a say something x times algorithm
public class DSayer extends AbsCmdReq implements Neuronable {
    private int times;
    private String param;

    public DSayer() {
        super();
        this.times = 1;
        this.param = "";
    }

    public static String regexChecker(String theRegex, String str2Check) {
        Pattern checkRegex = Pattern.compile(theRegex);
        Matcher regexMatcher = checkRegex.matcher(str2Check);
        while (regexMatcher.find()) {
            if (regexMatcher.group().length() != 0) {
                return regexMatcher.group().trim();
            }
        }
        return "";
    }

    @Override
    public void input(String command) {
        int foo = 1;
        String myString = regexChecker("(\\d+)(?= times)", command);
        String toSay = regexChecker("(?<=say)(.*)(?=\\d)", command);
        if (myString != "") {
            foo = Integer.parseInt(myString);
        } else {
            toSay = regexChecker("(?<=say)(.*)", command);
        }
        this.param = toSay;
        this.times = foo;
    }

    @Override
    public void output(Neuron noiron) {
        // TODO Auto-generated method stub
        if (!param.isEmpty()) {
            AbsAlgPart itte = new APSay(this.times, this.param);
            String representation = "say " + param;
            if (this.times > 1) {
                representation += " " + this.times + " times";
            }
            ArrayList<AbsAlgPart> algParts1 = new ArrayList<>();
            algParts1.add(itte);
            Algorithm algorithm = new Algorithm("say", representation, algParts1);
            noiron.algParts.add(algorithm);
        }

    }
}

DSpeller :

Code:


import java.util.ArrayList;

public class DSpeller extends AbsCmdReq implements Neuronable {
    private String param;
    private Boolean active;

    @Override
    public void output(Neuron noiron) {
        if (this.active) {
            APSpell maho = new APSpell(this.param);
            ArrayList<AbsAlgPart> algParts1 = new ArrayList<>();
            algParts1.add(maho);
            Algorithm algorithm = new Algorithm("spell", this.param, algParts1);
            noiron.algParts.add(algorithm);
        }
    }

    @Override
    public void input(String command) {
        // TODO Auto-generated method stub
        switch (command) {
            case "what is the time":
            case "what is the date":
            case "what is the year":
            case "current seconds":
            case "current minutes":
            case "current hour":
            case "which day is it":
            case "greet":
                active = true;
                this.param = command;
                break;
            default:
                active = false;
                break;

        }
    }

}
Very Happy

_________________
MB over and out emp it up
Back to top Go down
Moti Barski
super
super
Moti Barski

Posts : 395
Join date : 2011-08-02

beyond omega level coding Empty
PostSubject: enumFail   beyond omega level coding EmptyFri May 17, 2019 8:02 pm

I moti barski do not allow anyone and or anybody and or any organization to
receive monetary profit from this living grimoire unless writtenly approved by me personally.
you can use this for research.

name of the software : living grimoire : LG for short

enumFail :

Code:

/* failure types
 * ok : no fail
 * requip : item should be added
 * cloudian : algorithm goes to stand by in its Dclass
 * fail : no input
 * */
public enum enumFail {
 fail, requip, dequip, cloudian, ok
}

enumTimes :

Code:
public enum enumTimes {
    DATE, DAY, YEAR, HOUR, MINUTES, SECONDS
}

Friends :

Code:

public class Friends {
 private String master = "";
 private String[] friends = new String[10];
 private int[] friendVal = new int[10];
 private String[] goals = new String[10];
}

Fusion :

Code:
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.PriorityQueue;

public class Fusion {
    /*
     * fuses algorithms and sends needed algorithm to a designated cerabellum
     * cobject for activation
     */
 private Hashtable<String, Integer> AlgDurations;
 private Hashtable<String, Integer> AlgDurations2 = new Hashtable<>();
    private String emot = "";
    private PriorityQueue<Algorithm> algQueue = new PriorityQueue<Algorithm>();
    private PriorityQueue<Algorithm> dangerAlgQueue = new PriorityQueue<Algorithm>();
    private Boolean reqOverload = false; // too many requests
    private Boolean repReq = false; // chobit has already accepted this request
    private HashSet<String> represantations = new HashSet<String>();
    DExplorer dExplorer = new DExplorer();
    // private Cerabellum mainCera = new Cerabellum();
    // private Cerabellum dangerCera = new Cerabellum();
 private String[] goalsToTrack = { "", "" }; // dangerCera, mainCera
 private Cerabellum requipCera = new Cerabellum();
 // cerabellums :
 private Cerabellum dangerCera = new Cerabellum();
 // requip cera
 private FusionCera fusionCera;
 private Cerabellum mainCera = new Cerabellum();
 // home cera
 Cerabellum[] cera = new Cerabellum[4];
 // end cerabellums

 public Fusion(Hashtable<String, Integer> algDurations) {
 super();
 AlgDurations = algDurations;
 // fusionCera = (Cerabellum) (new FusionCera(algQueue));
 fusionCera = new FusionCera(algQueue);
 cera[0] = dangerCera;
 cera[1] = requipCera; //requip
 cera[2] = fusionCera;
 cera[3] = mainCera;
 // cera = { dangerCera, fusionCera, mainCera };
 }

 public void setAlgQueue(Neuron shinkei) {
        for (Algorithm algorithm : shinkei.negativeAlgParts) {
            if (this.dangerAlgQueue.size() < 1) {
                this.dangerAlgQueue.add(algorithm.clone());
            } else {
                break;
            }
        }
        this.repReq = false;
        for (Algorithm algorithm : shinkei.algParts) {
            updateRepresentations();
            if (this.represantations.contains(algorithm.getRepresentation())) {
                this.repReq = true;
                // System.out.println("again with this shit ?");
                continue;
            }
            if (this.algQueue.size() < 5) {
                this.algQueue.add(algorithm.clone());
            } else {
                break;
            }
        }
        this.reqOverload = this.algQueue.size() > 4 && shinkei.algParts.size() > 0;
        // empty Neuron
        shinkei.empty();
 if (!dangerCera.isActive() && !dangerAlgQueue.isEmpty()) {
 dangerCera.setAlgorithm(dangerAlgQueue.poll());
 goalsToTrack[0] = dangerCera.alg.getGoal();
 goalTrack(goalsToTrack[0]);
        }
 if (!mainCera.isActive() && !algQueue.isEmpty()) {
 mainCera.setAlgorithm(algQueue.poll());
 dExplorer.requip(requipCera, mainCera); // requip
 goalsToTrack[1] = mainCera.alg.getGoal();
 goalTrack(goalsToTrack[1]);
        }
 // fuse if, {fuse}
 // goalsToTrack[0] = goalTrackReset(goalsToTrack[0]);
 // goalsToTrack[1] = goalTrackReset(goalsToTrack[1]);
 fuze();
    }

    public Boolean getRepReq() {
        return repReq;
    }

    public Boolean getReqOverload() {
        return reqOverload;
    }

 public DCStrPair<String> act(String input) {
 DCStrPair<String> result = new DCStrPair<String>();
 result.key = "itemLess";
 result.value = "";
 // String axnStr = "";
        for (int i = 0; i < cera.length; i++) {
 if (cera[i].isActive()) {
 // dExplorer.mutate(null, cera[i],
 // dExplorer.gameShark.pegasus.get(cera[i].getEmot()).summonMutation(input,
 // cera[i].getFailType()));
 result = dExplorer.gameShark.autoEngage(cera[i].getEmot(), cera[i].act(input));
 dExplorer.mutate(cera[i],
 dExplorer.gameShark.finalMutation(cera[i].getEmot(), input, cera[i].getFailType()));
 cera[i].advanceInAlg();
                this.emot = cera[i].getEmot();
 if (i > 1) {
 int n1 = AlgDurations2.get(cera[i].alg.getGoal());
 AlgDurations2.put(cera[i].alg.getGoal(), n1 + 1);
 }
                break;
            }
            // else(cera notactive) try go home
        }
 return result;
    }

    public String getEmot() {
        return emot;
    }

    private void updateRepresentations() {
        this.represantations = new HashSet<String>();
        for (Algorithm algorithm : this.algQueue) {
            this.represantations.add(algorithm.getRepresentation());
        }
    }

 private void goalTrack(String goal) {
 if (!AlgDurations2.containsKey(goal)) {
 // try to load, if failed :
 AlgDurations.put(goal, 0);
 AlgDurations2.put(goal, 0);
 } else {
 AlgDurations.put(goal, AlgDurations2.get(goal));
 }
 }

 private String goalTrackReset(String goal) {
 if (!goal.equals("")) {
 AlgDurations2.put(goal, 0);
 }
 return "";
 }

 private void fuze() {
 if (mainCera.isActive() && !fusionCera.isActive()) {
 int algRunTime = AlgDurations.get(mainCera.alg.getGoal());
 algRunTime = algRunTime / 2;
 Algorithm alg1;
 String g1 = "";
 int time1 = 0;
 Iterator<Algorithm> iterator = algQueue.iterator();
 while (iterator.hasNext()) {
 alg1 = iterator.next();
 g1 = alg1.getGoal();
 goalTrack(g1);
 time1 = AlgDurations.get(g1);
 if (time1 < algRunTime) {
 fusionCera.setAlgorithm(alg1);
 fusionCera.setAbort(time1);
 goalTrackReset(g1);
 break;
 }
 // System.out.println(iterator.next());
 }
 }
 // TODO
 // del those lines from setalgqueue
 // and replace with this function.
 // uncheck algQueue.remove(super.alg); at FusionCera
 goalsToTrack[0] = goalTrackReset(goalsToTrack[0]);
 goalsToTrack[1] = goalTrackReset(goalsToTrack[1]);

 }
}

FusionCera :

Code:
import java.util.PriorityQueue;

public class FusionCera extends Cerabellum {
 private int abort;
 private PriorityQueue<Algorithm> algQueue;
 public FusionCera(PriorityQueue<Algorithm> algQueue) {
 super();
 this.abort = 0;
 this.algQueue = algQueue;
 }

 public void setAbort(int abort) {
 this.abort = abort + 1;
 }

 @Override
 public String act(String input) {
 // TODO Auto-generated method stub
 String result = super.act(input);
 abort--;
 if (abort < 1) {
 super.setActive(false);
 } else {
 if (!super.isActive()) {
 algQueue.remove(super.alg);
 }
 }
 return result;
 }
}

GameShark :

Code:
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Set;

/* represents all possible requipable items
 * activeSkills : type of item of item set for example :
 * bicycle with chain lock of transport items
 * */
public class GameShark {
   public Hashtable<String, McodeSet> allSkills = new Hashtable<>();
   public Hashtable<String, Mcode> activeSkills = new Hashtable<>();

   public Algorithm requipAlg = new Algorithm("disabled","", null);
   public Hashtable<String, TER> pegasus;
   public GameShark() {
      super();
      createMCodeSet("APSay", createMCode(new TER("nyaa", "", ""), new APSummonSkill(1, "kuchiyouse no jutsu")));
      addMCode("APSay", createMCode(new TER("buhi", "", ""), new APSummonSkill(1, "kuchiyouse no jutsu")));
   }

   public void setGameShark() {
      pegasus = new Hashtable<>();
      Set<String> keys = activeSkills.keySet();
        for(String key: keys){
         pegasus.put(key, activeSkills.get(key).ter);
        }
      if (pegasus.isEmpty()) {
      }
      reset();
   }
   public void addMcode(String AP) {
      Boolean boolean1 = allSkills.containsKey(AP);
      if (boolean1) {
         activeSkills.put(AP, allSkills.get(AP).activeMcode);
      if(requipAlg.getGoal().equals("disabled")) {requipAlg = allSkills.get(AP).activeMcode.algorithm;}
      else{requipAlg.getAlgParts().addAll(allSkills.get(AP).activeMcode.algorithm.getAlgParts());}}
   }
   public Algorithm getRequipAlg() {
        return requipAlg;
   }

   private void reset() {
      activeSkills = new Hashtable<>();
      requipAlg = new Algorithm("disabled","", null);
   }

   public DCStrPair<String> autoEngage(String AP, String input) {
      DCStrPair<String> result = new DCStrPair<String>();
      if (pegasus.containsKey(AP)) {
         result = pegasus.get(AP).autoEngage(input);
      } else {
         result.key = "itemLess";
         result.value = input;
      }
      return result;
   }

   public void outerMutate(String APCls) {
      if (allSkills.containsKey(APCls)) {
         if (!allSkills.get(APCls).skills.isEmpty()) {
            allSkills.get(APCls).marker++;
            if (allSkills.get(APCls).marker > allSkills.get(APCls).skills.size() - 1) {
               allSkills.get(APCls).marker = 0;
            }
            int x = allSkills.get(APCls).marker;
            allSkills.get(APCls).activeMcode = allSkills.get(APCls).skills.get(x);
         }
      }
   }

   public enumFail finalMutation(String AP, String input, enumFail fail1) {
      enumFail result = fail1;
      if (this.pegasus.containsKey(AP)) {
         result = pegasus.get(AP).summonMutation(input, fail1);
      }
      return result;
   }

   private void createMCodeSet(String AP, Mcode activeMCode) {
      McodeSet mcodeSet1 = new McodeSet();
      mcodeSet1.skills.add(activeMCode);
      mcodeSet1.activeMcode = activeMCode;
      mcodeSet1.name = "APSay";
      allSkills.put(mcodeSet1.name, mcodeSet1);
   }

   private Mcode createMCode(TER ter1, AbsAlgPart aPart) {
      Mcode mcode1 = new Mcode();
      mcode1.ter = ter1;
      ArrayList<AbsAlgPart> algParts1 = new ArrayList<>();
      algParts1.add(aPart);
      mcode1.algorithm = new Algorithm(ter1.getItemKey(), ter1.getItemKey(), algParts1);
      return mcode1;
   }

   private void addMCode(String AP, Mcode mCodeNxt) {
      allSkills.get(AP).skills.add(mCodeNxt);
   }
}
Very Happy

_________________
MB over and out emp it up
Back to top Go down
Moti Barski
super
super
Moti Barski

Posts : 395
Join date : 2011-08-02

beyond omega level coding Empty
PostSubject: Mcode class   beyond omega level coding EmptyFri May 17, 2019 8:07 pm

I moti barski do not allow anyone and or anybody and or any organization to
receive monetary profit from this living grimoire unless writtenly approved by me personally.
you can use this for research.

name of the software : living grimoire : LG for short


Mcode class:

Code:
public class Mcode {
   public int speed = 0;
   public TER ter;
   public Algorithm algorithm;
}

McodeSet :

Code:
import java.util.ArrayList;
import java.util.Random;

public class McodeSet {
   public String name;
   public Mcode activeMcode;
   public ArrayList<Mcode> skills = new ArrayList<>();
   public int marker = 0;

   public void mutateOuter() {
      Random rand = new Random();
      activeMcode = skills.get(rand.nextInt(skills.size()));
   }
}

MockDB :

Code:
import java.util.ArrayList;
import java.util.Hashtable;

// script holder for the dirty talk AP
public class MockDB {
    public Hashtable<String, String> hashtable;

    public MockDB() {
        super();
        ArrayList<String> AR1 = new ArrayList<>();
        AR1.add("start");
        AR1.add("hi honey");
        AR1.add("I love you");
        AR1.add("oh honey your dick so beutiful");
        AR1.add("would you like dinner a shower me ?");
        AR1.add("oh fuck yeah");
        AR1.add("please more honey");
        AR1.add("thank you");
        AR1.add("thank you so much");
        AR1.add("me so happy");
        AR1.add("me love you long time");
        AR1.add("chupa chupa");
        AR1.add("lick lick lick");
        String at = "start";
        this.hashtable = new Hashtable<>();
        for (String string : AR1) {
            hashtable.put(at, string);
            at = string;
        }

    }

    public Hashtable<String, String> getHashtable() {
        return (Hashtable<String, String>) hashtable.clone();
    }
}

Mutatable :

Code:
public interface Mutatable {
    public AbsAlgPart mutation();
}


Neuron :

Code:

import java.util.ArrayList;

// used to transport algorithms to other classes
public class Neuron {
    public ArrayList<Algorithm> algParts = new ArrayList<>();
    public ArrayList<Algorithm> negativeAlgParts = new ArrayList<>();
    public void empty() {
        this.algParts.clear();
        this.negativeAlgParts.clear();
    }
}

Neuronable :

Code:

public interface Neuronable {
    public void output(Neuron noiron);
}

OuterCerabellum :

Code:
import java.util.Hashtable;

/* resides outside of the chobit
 * connects an action sent as output by the chobit(s primoCera) to robotics actions and such
 * */
public class OuterCerabellum {
   private Hashtable<String, String> numFilteredInputOutput = new Hashtable<>();
}

Permission :

Code:
public class Permission {
    /*
    * uses two names as lv1,2 permission levels
    * requires password to change password or said names
    */
    private static Permission singleton;
    private String password, lv1Name, lv2Name;
    private int permissionLevel;

    private Permission(String password, String lv1Name, String lv2Name) {
        super();
        this.password = password;
        this.lv1Name = lv1Name;
        this.lv2Name = lv2Name;
    }

    public static Permission newInstance(String password, String lv1Name, String lv2Name) {
        if (singleton == null) {
            singleton = new Permission(password, lv1Name, lv2Name);
        }
        return singleton;
    }

    public int getPermissionLevel() {
        int result = this.permissionLevel;
        this.permissionLevel = 0;
        return result;
    }

    public void setPermissionLevel(String input) {
        if (input.contains(this.lv2Name)) {
            this.permissionLevel = 2;
        } else if (input.contains(this.lv1Name)) {
            this.permissionLevel = 1;
        }
        if (input.contains(this.lv2Name + " reset")) {
            this.permissionLevel = 0;
        }
    }

    public void setPassword(String oldPassword, String newPassword) {
        if (this.password.equals(password)) {
            this.password = newPassword;
        }
    }

    public Boolean setLv2Name(String password, String newName2) {
        if (this.password.equals(password)) {
            this.lv2Name = newName2;
            return true;
        }
        return false;
    }

    public String getLv1Name() {
        return lv1Name;
    }

    public Boolean setLv1Name(String password, String newName) {
        if (this.password.equals(password)) {
            this.lv1Name = newName;
            return true;
        }
        return false;
    }

    public static String clsmsg() {
        return "chaos ritual\r\n" + "\r\n" + "create two names\r\n" + "one soul will be called to the light\r\n"
                + "and one will be led by the darkness\r\n"
                + "and those souls of light and darkness will combine to create\r\n" + "the light of chaos\r\n"
                + "...\r\n" + "A.G.I descended!";
    }
}

Person :

Code:

public class Person {
   private String name = "";
   private Boolean active = true;
   private String phone = "";

   // email, location
   public String getName() {
      return name;
   }

   public void setName(String name) {
      this.name = name;
   }

   public Boolean getActive() {
      return active;
   }

   public void setActive(Boolean active) {
      this.active = active;
   }

   public String getPhone() {
      return phone;
   }

   public void setPhone(String phone) {
      this.phone = phone;
   }

}
Very Happy


_________________
MB over and out emp it up
Back to top Go down
Moti Barski
super
super
Moti Barski

Posts : 395
Join date : 2011-08-02

beyond omega level coding Empty
PostSubject: PlayGround class   beyond omega level coding EmptyFri May 17, 2019 8:09 pm

I moti barski do not allow anyone and or anybody and or any organization to
receive monetary profit from this living grimoire unless writtenly approved by me personally.
you can use this for research.

name of the software : living grimoire : LG for short

PlayGround class :

Code:
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

// times and stuff
public class PlayGround {
    // int foo = Integer.parseInt(myString);
    public String getCurrentTimeStamp() {
        // SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//
        // dd/MM/yyyy
        SimpleDateFormat sdfDate = new SimpleDateFormat("HH:mm");// dd/MM/yyyy
        Date now = new Date();
        String strDate = sdfDate.format(now);
        return strDate;
    }

    public String getMinutes() {
        // SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//
        // dd/MM/yyyy
        SimpleDateFormat sdfDate = new SimpleDateFormat("mm");// dd/MM/yyyy
        Date now = new Date();
        String strDate = sdfDate.format(now);
        return strDate;
    }

    public String getSeconds() {
        // SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//
        // dd/MM/yyyy
        SimpleDateFormat sdfDate = new SimpleDateFormat("ss");// dd/MM/yyyy
        Date now = new Date();
        String strDate = sdfDate.format(now);
        return strDate;
    }

    public String getDayOfDWeek() {
        Date now = new Date();
        Calendar c = Calendar.getInstance();
        c.setTime(now);
        int dayOfWeek = c.get(Calendar.DAY_OF_WEEK);
        return convertToDay(dayOfWeek);
    }

    private String convertToDay(Integer d) {
        String result = "";
        switch (d) {
            case 1:
                result = "sunday";
                break;
            case 2:
                result = "monday";
                break;
            case 3:
                result = "tuesday";
                break;
            case 4:
                result = "wednesday";
                break;
            case 5:
                result = "thursday";
                break;
            case 6:
                result = "friday";
                break;
            case 7:
                result = "saturday";
                break;
            default:
                break;
        }
        return result;
    }

    public String getSpecificTime(enumTimes timeType) {
        // SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//
        // dd/MM/yyyy
        SimpleDateFormat sdfDate;
        String format = "";
        switch (timeType) {
            case DATE:
                format = "yyyy-MM-dd";
                break;
            case HOUR:
                format = "HH";
                break;
            case SECONDS:
                format = "ss";
                break;
            case MINUTES:
                format = "mm";
                break;
            case YEAR:
                format = "yyyy";
                break;
            default:
                break;
        }
        sdfDate = new SimpleDateFormat(format);
        Date now = new Date();
        String strDate = sdfDate.format(now);
        return strDate;
    }

    public int getSecondsAsInt() {
        // SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//
        // dd/MM/yyyy
        SimpleDateFormat sdfDate = new SimpleDateFormat("ss");// dd/MM/yyyy
        Date now = new Date();
        String strDate = sdfDate.format(now);
        return Integer.parseInt(strDate);
    }

    public int getMinutesAsInt() {
        // SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//
        // dd/MM/yyyy
        SimpleDateFormat sdfDate = new SimpleDateFormat("mm");// dd/MM/yyyy
        Date now = new Date();
        String strDate = sdfDate.format(now);
        return Integer.parseInt(strDate);
    }

    public int getHoursAsInt() {
        // SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//
        // dd/MM/yyyy
        SimpleDateFormat sdfDate = new SimpleDateFormat("HH");// dd/MM/yyyy
        Date now = new Date();
        String strDate = sdfDate.format(now);
        return Integer.parseInt(strDate);
    }

   public String getFutureInXMin(int x) {
      Calendar cal = Calendar.getInstance();
      cal.add(Calendar.MINUTE, x);
      SimpleDateFormat df = new SimpleDateFormat("HH:mm");
      return df.format(cal.getTime());
   }

   public String getFutureFromXInYMin(int x, String y) {
      Calendar cal = Calendar.getInstance();
      SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
      try {
         cal.setTime(sdf.parse(y));
      } catch (ParseException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      } // all done
      cal.add(Calendar.MINUTE, x);
      return sdf.format(cal.getTime());
   }
}

PrimoCera :

Code:
import java.util.Hashtable;

/* the actual action
 * for example go left, jump right
 * see outerCerabellum class for more detail
 * */
public class PrimoCera {
   private Hashtable<Integer, String> numAction = new Hashtable<>();
   private Hashtable<String, Integer> keyvalNum = new Hashtable<>();

   public void saveAction(String str, int num) {
      keyvalNum.put(str, num);
   }
   public int getFinalActionCode() {
      return numAction.size();
   }
}

RegexUtil :

Code:
import java.util.regex.Matcher;
import java.util.regex.Pattern;

// returns expression of type theRegex from the string str2Check
public class RegexUtil {
    public String regexChecker(String theRegex, String str2Check) {
        Pattern checkRegex = Pattern.compile(theRegex);
        Matcher regexMatcher = checkRegex.matcher(str2Check);
        while (regexMatcher.find()) {
            if (regexMatcher.group().length() != 0) {
                return regexMatcher.group().trim();
            }
        }
        return "";
    }
}

Soul :

Code:
import java.util.Arrays;

public class Soul {
   private int[] goalVal = new int[3];
   private String[] goals = new String[3];

   public Soul() {
      super();
      Arrays.fill(goals, "");
      Arrays.fill(goalVal, 0);
   }

}

TER :

Code:
public class TER {
   // thousand eyes restrict
   // @ used with Hashtable<String, TER> pegasus = new Hashtable<>();
   // handles a part of an item
   private static final String FEEL = "#";
   private String itemKey = "";
   private String engageOn = "";// see item
   private String toFeel = "";

   public String getItemKey() {
      return itemKey;
   }

   public TER(String itemKey, String engageOn, String toFeel) {
      super();
      this.itemKey = itemKey;
      this.engageOn = engageOn;
      this.toFeel = toFeel;
      if (engageOn.isEmpty()) {
         engageOn = "%&^**()!!@#$";
      }
   }

   public DCStrPair<String> autoEngage(String str1) {
      // send image to grab + grab part
      // or what happens at condition x
      DCStrPair<String> result = new DCStrPair<>();
      if (str1.contains(engageOn) && !engageOn.equals("")) {
         result.key = FEEL;
         result.value = toFeel;
         return result;
      }
      result.key = this.itemKey;
      result.value = str1;
      return result;
   }

   public enumFail summonMutation(String str1, enumFail eFail) {
      // if no feel at needed area or no visual of Mcode
      // return fail.mutation
      if (!str1.contains(toFeel) && str1.contains(FEEL) && !str1.contains(engageOn)) {
         return enumFail.requip;
      } // *counter
      return eFail;
   }
}

king

_________________
MB over and out emp it up
Back to top Go down
 
beyond omega level coding
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
battle programmers alliance :: battle programming alliance :: battle programming-
Jump to: