new auxiliary module translation code party TEAM FUKI ASSEMBLE!

owly

闇の伝説
Staff member
戦闘 コーダー
project progress at 100%
 
0% 100%

  1. +TODOListManager
  2. +DrawRnd
  3. +AXLHub
  4. +AXLHousing
  5. +AXNeuroSama
  6. +AXLNeuroSama
  7. +AXLearnability
  8. +TrgTolerance
  9. +Cycler
  10. +Perchance
  11. +AXKeyValuePair
  12. +InputFilter // context juubi
  13. +strategy
  14. +AXStrategy
  15. +LGTypeConverter
  16. +OutputDripper
  17. +PersistantAnswer
  18. +UniqueItemSizeLimitedPriorityQueue
@fukurou :h3:
 
Last edited by a moderator:

fukurou

the supreme coder
ADMIN
Java:
public class DrawRnd {
    // draw a random element, than take said element out
    private ArrayList<String> strings = new ArrayList<>();
    private ArrayList<String> stringsSource = new ArrayList<>();
    private Random rand = new Random();
    public DrawRnd(String... values) {
        for (int i = 0; i < values.length; i++) {
            strings.add(values[i]);
            stringsSource.add(values[i]);
        }
    }
    public String draw(){
        if (strings.isEmpty()) {return "";}

        int x = rand.nextInt(strings.size());
        String element = strings.get(x);
        strings.remove(x);
        return element;
    }
    public int getSimpleRNDNum(int bound){
        // return 0->bound-1
        return rand.nextInt(bound);
    }
    private LGTypeConverter tc = new LGTypeConverter();
    public int drawAsInt(){
        if (strings.isEmpty()) {return 0;}
        Random rand = new Random();
        int x = rand.nextInt(strings.size());
        String element = strings.get(x);
        strings.remove(x);
        return tc.convertToInt(element);
    }
    public void reset(){
        DeepCopier dc = new DeepCopier();
        strings = dc.copyList(stringsSource);
    }
}
 

fukurou

the supreme coder
ADMIN
Swift:
class DrawRnd {
    private var numbers:Array<Int> = [Int]()
    init(size:Int){
        for index in 1...size{
            numbers.append(index)
        }
    }
    init(_ markers:Int...) {
        for num in markers {
            numbers.append(num)
        }
    }
    func draw() -> Int {
        if numbers.isEmpty {return 0}
        let x:Int = Int.random(in: 0..<numbers.count)
        let element:Int = numbers[x]
        numbers.remove(at: x)
        return element
    }
}
 

fukurou

the supreme coder
ADMIN
Swift:
class DrawRnd {
    // draw a random element, than take said element out
    private var strings:Array<String> = [String]()
    private var stringsSource:Array<String> = [String]()
    init(_ values:String...) {
        for temp in values {
            strings.append(temp)
            stringsSource.append(temp)
        }
    }
    func draw() -> String {
        if strings.isEmpty {return ""}
        let x:Int = Int.random(in: 0..<strings.count)
        let element:String = strings[x]
        strings.remove(at: x)
        return element
    }
    func reset(){
        let dc:DeepCopier = DeepCopier()
        strings = dc.copyList(original: stringsSource)
    }
    func getSimpleRNDNum(bound:Int)->Int{
        // return 0->bound-1
        return Int.random(in: 0...bound-1)
    }
    private let tc:LGTypeConverter = LGTypeConverter()
    func drawAsInt()->Int{
        return tc.convertToInt(v1: draw())
    }
}
class LGTypeConverter{
    func convertToInt(v1:String)->Int{
        return Int(v1) ?? 0
    }
    func convertToDouble(v1:String)->Double{
        return Double(v1) ?? 0
    }
}
 

owly

闇の伝説
Staff member
戦闘 コーダー
lets do the AXLHousing next
Java:
public class AXLHousing {
    public String decorate(String str1){
        // override me
        return "";
    }
}
 

fukurou

the supreme coder
ADMIN
Swift:
class AXLHousing{
    func decorate(str1:String)->String{
        // override me
        return ""
    }
}
 

owly

闇の伝説
Staff member
戦闘 コーダー

Java:
public class AXLHub {
    // hubs many reply decorators, language translators, encriptors and other string modifiers
    // decorate(str) to decorate string using the active string decorator
    private Cycler cycler;
    private DrawRnd drawRnd = new DrawRnd();
    private int size = 0;
    private ArrayList<AXLHousing> nyaa = new ArrayList<AXLHousing>();
    private int activeNyaa = 0;
    public AXLHub(AXLHousing...nyaa) {
        for (AXLHousing temp : nyaa)
        {
            this.nyaa.add(temp);
        }
        size = this.nyaa.size();
        cycler = new Cycler(size -1);
        cycler.setToZero();
    }
    public String decorate(String str1){
        return nyaa.get(activeNyaa).decorate(str1);
    }
    public void cycleDecoration(){
        activeNyaa = cycler.cycleCount();
    }
    public void randomizeDecoration(){
        activeNyaa = drawRnd.getSimpleRNDNum(size);
    }
    public void modeDecoration(int mode){
        if(mode < -1){return;}
        if(mode >= nyaa.size()){return;}
        activeNyaa = mode;
    }
}
 

fukurou

the supreme coder
ADMIN
Swift:
class Cycler{
    private var cycler:Int = 0
    private var limit:Int
    init(limit:Int) {
        self.limit = limit
        self.cycler = limit
    }
    func getLimit()->Int{
        return self.limit
    }
    func setLimit(limit:Int){
        self.limit = limit
    }
    func cycleCount()->Int{
        cycler-=1
        if(cycler < 0){
            cycler = limit
        }
        return cycler
    }
    func reset(){
        cycler = limit
    }
    func setToZero(){
        cycler = 0
    }
    func sync(n:Int){
        if (-1>n) || (n>limit) {
            return
        }
        cycler = n
    }
}
 

fukurou

the supreme coder
ADMIN
Swift:
class AXLHub{
    // hubs many reply decorators, language translators, encriptors and other string modifiers
    // decorate(str) to decorate string using the active string decorator
    private let cycler:Cycler
    private let drawRnd:DrawRnd = DrawRnd()
    private var size:Int = 0
    private var nyaa:Array<AXLHousing> = [AXLHousing]()
    private var activeNyaa:Int = 0
    init(_nyaa:AXLHousing...) {
        for temp in nyaa{
            self.nyaa.append(temp)
        }
        size = self.nyaa.count
        cycler = Cycler(limit: size - 1)
        cycler.setToZero()
    }
    func decorate(str1:String)->String{
        return nyaa[activeNyaa].decorate(str1: str1)
    }
    func cycleDecoration(){
        activeNyaa = cycler.cycleCount()
    }
    func randomizeDecoration(){
        activeNyaa = drawRnd.getSimpleRNDNum(bound: size)
    }
    func modeDecoratrion(mode:Int){
        if mode < 0{return}
        if mode >= nyaa.count {return}
        activeNyaa = mode
    }
}
 

fukurou

the supreme coder
ADMIN

Swift:
public class AXNeuroSama {
    private Responder nyaa = new Responder(" heart", " heart", " wink", " heart heart heart");
    private DrawRnd rnd = new DrawRnd();
    private int rate;

    public AXNeuroSama(int rate) {
        // the higher the rate the less likely to decorate outputs
        this.rate = rate;
    }

    public String decorate(String output){
        if (output.isEmpty()){
            return output;
        }
        String result = "";
        if(rnd.getSimpleRNDNum(rate) == 0){
            return output + nyaa.getAResponse();
        }
        return output;
    }
}
 

fukurou

the supreme coder
ADMIN
Swift:
class AXNeuroSama{
    private let nyaa:Responder = Responder(" heart", " heart", " wink", " heart heart heart")
    private let rnd:DrawRnd = DrawRnd()
    private var rate:Int
    init(rate: Int) {
        // the higher the rate the less likely to decorate outputs
        // recomended value = 3
        self.rate = rate
    }
    func decorate(output:String)->String{
        if output.isEmpty{return ""}
        if rnd.getSimpleRNDNum(bound: rate) == 0{return output + nyaa.getAResponse()}
        return output
    }
}
 

fukurou

the supreme coder
ADMIN
Java:
public class AXLNeuroSama extends AXLHousing{
    private AXNeuroSama nyaa = new AXNeuroSama(3);

    @Override
    public String decorate(String str1) {
        return this.nyaa.decorate(str1);
    }
}
:s71:
 

fukurou

the supreme coder
ADMIN
Swift:
class AXLNeuroSama{
    private let nyaa:AXNeuroSama = AXNeuroSama(rate: 3)
    func decorate(_ str1: String) -> String {
        return self.nyaa.decorate(output: str1)
    }
}
I used nameless swift function parameters for this one :s21:
 

owly

闇の伝説
Staff member
戦闘 コーダー
Java:
public class AXLearnability {
    private Boolean algSent = false;
    // problems that may result because of the last deployed algorithm:
    public UniqueItemSizeLimitedPriorityQueue defcons = new UniqueItemSizeLimitedPriorityQueue();// default size = 5
    // major chaotic problems that may result because of the last deployed algorithm:
    public UniqueItemSizeLimitedPriorityQueue defcon5 = new UniqueItemSizeLimitedPriorityQueue();
    // goals the last deployed algorithm aims to achieve:
    public UniqueItemSizeLimitedPriorityQueue goals = new UniqueItemSizeLimitedPriorityQueue();
    // how many failures / problems till the algorithm needs to mutate (change)
    public TrgTolerance trgTolerance;

    public AXLearnability(int tolerance) {
        this.trgTolerance = new TrgTolerance(tolerance);
        trgTolerance.reset();
    }
    public void pendAlg(){
        // an algorithm has been deployed
        // call this method when an algorithm is deployed (in a DiSkillV2 object)
        algSent = true;
        trgTolerance.trigger();
    }
    public void pendAlgWithoutConfirmation(){
        // an algorithm has been deployed
        algSent = true;
        //no need to await for a thank you or check for goal manifestation :
        // trgTolerance.trigger();
        // using this method instead of the default "pendAlg" is the same as
        // giving importance to the stick and not the carrot when learning
        // this method is mosly fitting work place situations
    }
    public Boolean mutateAlg(String input){
        // recommendation to mutate the algorithm ? true/ false
        if (!algSent) {return false;} // no alg sent=> no reason to mutate
        if (goals.contains(input)){trgTolerance.reset();algSent = false;return false;}
        // goal manifested the sent algorithm is good => no need to mutate the alg
        if (defcon5.contains(input)) {trgTolerance.reset();algSent = false; return true;}
        // ^ something bad happend probably because of the sent alg
        // recommend alg mutation
        if (defcons.contains(input)){algSent = false;
            Boolean mutate= !trgTolerance.trigger();
            if(mutate){
                trgTolerance.reset();
            }
            return mutate;}
        // ^ negative result, mutate the alg if this occures too much
        return false;
    }
}
 
Top