👨‍💻 dev DiBlueCrystal

development

fukurou

the supreme coder
ADMIN

1st draft:
dicN{}
keysN
quiz:drawRnd

get word gem:
quiz<-wordgem
ret rnd(wordGem)

quiz me:
solution = t[q]
ret drawRnd

cmdBreaker
if ear = solution
score++;
ret (correct)
else
score = 0;ret(bubu)

what is my score
ret score

*clear score
*category
quiz meaning, *translate
 

fukurou

the supreme coder
ADMIN
Java:
import java.util.ArrayList;
import java.util.HashMap;

public class Main {
    public static void main(String[] args) {
        ArrayList<HashMap<String, String>> list = new ArrayList<>();

        // Adding a new HashMap to the list
        HashMap<String, String> map = new HashMap<>();
        map.put("key1", "value1");
        map.put("key2", "value2");
        list.add(map);

        // Accessing elements
        System.out.println(list.get(0).get("key1"));  // Outputs "value1"
    }
}
 

fukurou

the supreme coder
ADMIN
Java:
import AXJava.AXContextCmd;
import AXJava.DrawRnd;
import LivinGrimoire.DiSkillV2;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;

public class DiBlueCrystal extends DiSkillV2 {
    private ArrayList<HashMap<String, String>> categories = new ArrayList<>();
    private DrawRnd quiz = new DrawRnd();
    private ArrayList<String> keyList = new ArrayList<>();
    private int categoryIndex = 0;
    private AXContextCmd teach = new AXContextCmd();

    public DiBlueCrystal() {
        teach.contextCommands.add("teach me");
        teach.commands.add("more");
        teach.commands.add("next");
        teach.commands.add("again");
    }

    public void addCategory(HashMap<String, String> category){
        categories.add(category);
        keyList = new ArrayList<>(category.keySet());
    }

    @Override
    public void input(String ear, String skin, String eye) {
        if (ear.isEmpty()){return;}
        // get word gem
        if (teach.engageCommand(ear)){
            Random rand = new Random();
            int randomIndex = rand.nextInt(keyList.size());
            String wordGem = keyList.get(randomIndex);
            String translation = categories.get(categoryIndex).get(wordGem);
            quiz.addElement(wordGem);
            setSimpleAlg(String.format("%s means %s", wordGem, translation));
            return;
        }
    }
}
 

fukurou

the supreme coder
ADMIN
Java:
import AXJava.AXCmdBreaker;
import AXJava.AXContextCmd;
import AXJava.DrawRnd;
import LivinGrimoire.DiSkillV2;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;

public class DiBlueCrystal extends DiSkillV2 {
    private ArrayList<HashMap<String, String>> categories = new ArrayList<>();
    private DrawRnd quiz = new DrawRnd();
    private ArrayList<String> keyList = new ArrayList<>();
    private int categoryIndex = 0;
    private AXContextCmd teach = new AXContextCmd();
    private AXContextCmd quizMe = new AXContextCmd();
    private String expectedSolution = "";
    private AXCmdBreaker itMeans = new AXCmdBreaker("it means");

    public DiBlueCrystal() {
        teach.contextCommands.add("teach me");
        teach.commands.add("more");
        teach.commands.add("next");
        teach.commands.add("again");
        quizMe.contextCommands.add("quiz me");
        quizMe.commands.add("more");
        quizMe.commands.add("next");
        quizMe.commands.add("again");
    }

    public void addCategory(HashMap<String, String> category){
        categories.add(category);
        keyList = new ArrayList<>(category.keySet());
    }

    @Override
    public void input(String ear, String skin, String eye) {
        if (ear.isEmpty()){return;}
        // get word gem
        if (teach.engageCommand(ear)){
            Random rand = new Random();
            int randomIndex = rand.nextInt(keyList.size());
            String wordGem = keyList.get(randomIndex);
            String translation = categories.get(categoryIndex).get(wordGem);
            quiz.addElement(wordGem);
            setSimpleAlg(String.format("%s means %s", wordGem, translation));
            return;
        }
        // quiz user
        if(quizMe.engageCommand(ear)){
            String question = quiz.draw();
            if (question.isEmpty()){
                Random rand = new Random();
                question = keyList.get(rand.nextInt(keyList.size()));
            }
            setSimpleAlg(String.format("what does %s mean", question));
            expectedSolution = "it means " + categories.get(categoryIndex).get(question);
            return;
        }
    }
}
 

fukurou

the supreme coder
ADMIN
Java:
package skills;

import AXJava.AXCmdBreaker;
import AXJava.AXContextCmd;
import AXJava.DrawRnd;
import LivinGrimoire.DiSkillV2;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;

public class DiBlueCrystal extends DiSkillV2 {
    private ArrayList<HashMap<String, String>> categories = new ArrayList<>();
    private DrawRnd quiz = new DrawRnd();
    private ArrayList<String> keyList = new ArrayList<>();
    private int categoryIndex = 0;
    private AXContextCmd teach = new AXContextCmd();
    private AXContextCmd quizMe = new AXContextCmd();
    private String expectedSolution = "";
    private AXCmdBreaker itMeans = new AXCmdBreaker("it means");
    private int score = 0;

    public DiBlueCrystal() {
        teach.contextCommands.add("teach me");
        teach.commands.add("more");
        teach.commands.add("next");
        teach.commands.add("again");
        quizMe.contextCommands.add("quiz me");
        quizMe.commands.add("more");
        quizMe.commands.add("next");
        quizMe.commands.add("again");
    }

    public void addCategory(HashMap<String, String> category){
        categories.add(category);
        keyList = new ArrayList<>(category.keySet());
    }

    @Override
    public void input(String ear, String skin, String eye) {
        if (ear.isEmpty()){return;}
        // get word gem
        if (teach.engageCommand(ear)){
            Random rand = new Random();
            int randomIndex = rand.nextInt(keyList.size());
            String wordGem = keyList.get(randomIndex);
            String translation = categories.get(categoryIndex).get(wordGem);
            quiz.addElement(wordGem);
            setSimpleAlg(String.format("%s means %s", wordGem, translation));
            return;
        }
        // manual category change:
        if(ear.equals("next category")){
            nxtCategory();
            setSimpleAlg("ok");
            return;
        }
        // quiz user
        if(quizMe.engageCommand(ear)){
            String question = quiz.draw();
            if (question.isEmpty()){
                Random rand = new Random();
                question = keyList.get(rand.nextInt(keyList.size()));
            }
            setSimpleAlg(String.format("what does %s mean", question));
            expectedSolution = "it means " + categories.get(categoryIndex).get(question);
            return;
        }
        // get score
        if(ear.equals("what is my score")){
            setSimpleAlg("your score is "+score+"");
            return;
        }
    }
    private void nxtCategory(){
        categoryIndex++;
        if (categoryIndex == keyList.size()){categoryIndex = 0;}
    }
}
 

fukurou

the supreme coder
ADMIN
Java:
package skills;

import AXJava.AXCmdBreaker;
import AXJava.AXContextCmd;
import AXJava.DrawRnd;
import LivinGrimoire.DiSkillV2;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;

public class DiBlueCrystal extends DiSkillV2 {
    private ArrayList<HashMap<String, String>> categories = new ArrayList<>();
    private DrawRnd quiz = new DrawRnd();
    private ArrayList<String> keyList = new ArrayList<>();
    private int categoryIndex = 0;
    private AXContextCmd teach = new AXContextCmd();
    private AXContextCmd quizMe = new AXContextCmd();
    private String expectedSolution = "";
    private AXCmdBreaker itMeans = new AXCmdBreaker("it means");
    private int score = 0;
    private int lvUpAt = 10;

    public DiBlueCrystal() {
        teach.contextCommands.add("teach");
        teach.commands.add("more");
        teach.commands.add("next");
        teach.commands.add("again");
        quizMe.contextCommands.add("quiz");
        quizMe.commands.add("more");
        quizMe.commands.add("next");
        quizMe.commands.add("again");
    }

    public void setLvUpAt(int lvUpAt) {
        this.lvUpAt = lvUpAt;
    }

    public void addCategory(HashMap<String, String> category){
        categories.add(category);
        keyList = new ArrayList<>(category.keySet());
    }

    @Override
    public void input(String ear, String skin, String eye) {
        if (ear.isEmpty()){return;}
        // get word gem
        if (teach.engageCommand(ear)){
            Random rand = new Random();
            int randomIndex = rand.nextInt(keyList.size());
            String wordGem = keyList.get(randomIndex);
            String translation = categories.get(categoryIndex).get(wordGem);
            quiz.addElement(wordGem);
            setSimpleAlg(String.format("%s means %s", wordGem, translation));
            return;
        }
        // manual category change:
        if(ear.equals("next category")){
            nxtCategory();
            setSimpleAlg("ok");
            return;
        }
        // quiz user
        if(quizMe.engageCommand(ear)){
            String question = quiz.draw();
            if (question.isEmpty()){
                Random rand = new Random();
                question = keyList.get(rand.nextInt(keyList.size()));
            }
            setSimpleAlg(String.format("what does %s mean", question));
            expectedSolution = "it means " + categories.get(categoryIndex).get(question);
            return;
        }
        // get score
        if(ear.equals("score")){
            setSimpleAlg(String.format("your score is %d of %d", score, lvUpAt));
            return;
        }
        // get current level
        if(ear.equals("level")){
            setSimpleAlg(String.format("your level is %d ", categoryIndex));
            return;
        }
        // answer
        if(ear.contains("it means") && (!expectedSolution.isEmpty())){
            if(ear.equals(expectedSolution)){
                expectedSolution = "";
                // correct solution
                score++;
                // level up?
                if(score == lvUpAt){score = 0;nxtCategory();setSimpleAlg("leveled up");
                }
                else {setSimpleAlg("correct");
                }
            }
            else {
                expectedSolution = "";
                score = 0;
                setSimpleAlg("bu bu wrong answer");
            }
            return;
        }
    }
    private void nxtCategory(){
        categoryIndex++;
        if (categoryIndex == categories.size()){categoryIndex = 0;}
    }
}
 

fukurou

the supreme coder
ADMIN
Java:
public class RussianWordGems {
    private DiBlueCrystal o1 = new DiBlueCrystal();
    public RussianWordGems() {
        HashMap<String, String> map = new HashMap<>();
        map.put("privyet", "hello");
        map.put("dobre utra", "good morning");
        map.put("kniga", "book");
        o1.addCategory(map);
    }
    public DiBlueCrystal retSkill(){
        return o1;
    }
}
 
Top