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

battle programming a forum for elite programmers with extreme will power to sharpen their skills
HomeGallerySearchRegisterLog in

 added database capabilities

Go down 

Posts : 293
Join date : 2012-04-17

added database capabilities Empty
PostSubject: added database capabilities   added database capabilities EmptyTue Jan 26, 2021 4:28 pm

the grimoirememento class of the kokoro class
now has a save and a load function.

any new skill that uses the kokoro class such as DiSkill and TheSkill can use DB
capabilities to save and load.

her is the 1st example use : DiSayer class (java cls)
example use : honey say pen
output : pen

honey say something
output : pen
it doesn't matter if you turned off the app and reopened. she remembers.

package com.yotamarker.lgkotlin1;

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

public class DiSayer extends  DISkill{
    private int times;
    private String param;
    public DiSayer(Kokoro kokoro) {
        this.times = 1;
        this.param = "";

    public void input(String ear, String skin, String eye) {
        if(ear.contains("say something")){
            this.param = kokoro.grimoireMemento.simpleLoad("something");
        int foo = 1;
        String myString = regexChecker("(\\d+)(?= times)", ear);
        String toSay = regexChecker("(?<=say)(.*)(?=\\d)", ear);
        if (myString != "") {
            foo = Integer.parseInt(myString);
        } else {
            toSay = regexChecker("(?<=say)(.*)", ear);
        this.param = toSay;
        this.times = foo;

    public void output(Neuron noiron) {
        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<>();
            Algorithm algorithm = new Algorithm("say", representation, algParts1);
    public static String regexChecker(String theRegex, String str2Check) {
        Pattern checkRegex = Pattern.compile(theRegex);
        Matcher regexMatcher = checkRegex.matcher(str2Check);
        while (regexMatcher.find()) {
            if ( != 0) {
        return "";

battle programming
Back to top Go down
added database capabilities
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 :: the LivinGrimoire-
Jump to: