AX beefup

owly

闇の伝説
Staff member
戦闘 コーダー
Swift:
class Log:UniqueItemsPriorityQue {
    /// chronological log of inputs
    private var lastWithdrawal:String = ""
    override func peak() -> String {
        /// get last memory
        lastWithdrawal = super.peak()
        return lastWithdrawal
    }
    override func getRndItem() -> String {
        /// get random memory
        lastWithdrawal = super.getRndItem()
        return lastWithdrawal
    }
    @discardableResult
    func removeLastWithdrawal() ->String{
        /// remove last processed memory
        deleteStr(str1: self.lastWithdrawal)
        let temp = lastWithdrawal
        lastWithdrawal = ""
        return temp
    }
    override func poll() -> String {
        return peak()
    }
}
class AXListeaNLearn{
    /// this module learn places, items and persons relevant to the skill's goal
    ///  by listening to people
    let logNegative:Log
    let logPossitive:Log
    init(logMinus:Log, logPlus:Log) {
        self.logNegative = logMinus
        self.logPossitive = logPlus
    }
    // learnability mutation = true
    func forget() {
        /// an algorithm using the item, failed (reported by a Learnability class or a cloudian object)
        ///  and so it will be moved to the lies Log
        let temp = logPossitive.removeLastWithdrawal()
        logNegative.input(in1: temp)
    }
    func clearNegativeLog() {
        /// clear memory of lies and failed items
        ///  this can be done once in a time period
        ///   allowing for reconsideration of items that didn't work in the past
        ///   but may work in the future
        logNegative.clearData()
    }
    func peak() -> String {
        // get 1st item from assumed working items, log
        return logPossitive.peak()
    }
    func RndPeak() -> String {
        // get random item from assumed working items, log
        return logPossitive.getRndItem()
    }
    /// new data should be aquired via a regex for the verb/verb that correspond to
    ///  the skill using the module
    func insert(str1:String) {
        // failed data AKA a lie is not accepted
        if !logNegative.contains(str: str1){
            logPossitive.input(in1: str1)
        }
    }
}
 

fukurou

the supreme coder
ADMIN
Swift:
class Log:UniqueItemsPriorityQue {
    /// chronological log of inputs
    private var lastWithdrawal:String = ""
    override func peak() -> String {
        /// get last memory
        lastWithdrawal = super.peak()
        return lastWithdrawal
    }
    override func getRndItem() -> String {
        /// get random memory
        lastWithdrawal = super.getRndItem()
        return lastWithdrawal
    }
    @discardableResult
    func removeLastWithdrawal() ->String{
        /// remove last processed memory
        deleteStr(str1: self.lastWithdrawal)
        let temp = lastWithdrawal
        lastWithdrawal = ""
        return temp
    }
    override func poll() -> String {
        return peak()
    }
}
class AXListeaNLearn{
    /// this module learn places, items and persons relevant to the skill's goal
    ///  by listening to people
    let logNegative:Log
    let logPossitive:Log
    init(logMinus:Log, logPlus:Log) {
        self.logNegative = logMinus
        self.logPossitive = logPlus
    }
    // learnability mutation = true
    func forget() {
        /// an algorithm using the item, failed (reported by a Learnability class or a cloudian object)
        ///  and so it will be moved to the lies Log
        let temp = logPossitive.removeLastWithdrawal()
        logNegative.input(in1: temp)
    }
    func clearNegativeLog() {
        /// clear memory of lies and failed items
        ///  this can be done once in a time period
        ///   allowing for reconsideration of items that didn't work in the past
        ///   but may work in the future
        logNegative.clearData()
    }
    func peak() -> String {
        // get 1st item from assumed working items, log
        return logPossitive.peak()
    }
    func RndPeak() -> String {
        // get random item from assumed working items, log
        return logPossitive.getRndItem()
    }
    /// new data should be aquired via a regex for the verb/verb that correspond to
    ///  the skill using the module
    func insert(str1:String) {
        // failed data AKA a lie is not accepted
        if !logNegative.contains(str: str1){
            logPossitive.input(in1: str1)
        }
    }
}
we could just have a learnability module send lies to a spider sense
 

fukurou

the supreme coder
ADMIN
should it have an alert clrScr tho?
Java:
package AXJava;

import LivinGrimoire.DeepCopier;

import java.util.ArrayList;

public class SpiderSense {
    // enables event prediction
    private Boolean spiderSense = false;
    private UniqueItemSizeLimitedPriorityQueue events = new UniqueItemSizeLimitedPriorityQueue();
    private UniqueItemSizeLimitedPriorityQueue alerts = new UniqueItemSizeLimitedPriorityQueue();
    private String prev = "";
    public SpiderSense addEvent(String event){
        // builder pattern
        events.add(event);
        return this;
    }
    // input param  can be run through an input filter prior to this function
    // weather related data (sky state) only for example for weather events predictions
    public void learn(String in1){
        // simple prediction of an event from the events que :
        if (alerts.contains(in1)){
            spiderSense = true;return;
        }
        // event has occured, remember what lead to it
        if (events.contains(in1)){
            alerts.add(prev);return;
        }
        // nothing happend
        prev = in1;
    }

    public Boolean getSpiderSense() {
        // spider sense is tingling? event predicted?
        Boolean temp = spiderSense; spiderSense = false;
        return temp;
    }
    public ArrayList<String> getAlertsShallowCopy(){
        // return shallow copy of alerts list
        return alerts.getElements();
    }
    public ArrayList<String> getAlertsClone(){
        // return deep copy of alerts list
        DeepCopier dc = new DeepCopier();
        return dc.copyList(alerts.getElements());
    }
    public void clearAlerts(){
        alerts.clear();
    }
}

it does now.
add the documentation
this is the way:s54:
 

owly

闇の伝説
Staff member
戦闘 コーダー
Java:
package AXJava;

import LivinGrimoire.DeepCopier;

import java.util.ArrayList;

public class SpiderSense {
    // enables event prediction
    private Boolean spiderSense = false;
    private UniqueItemSizeLimitedPriorityQueue events = new UniqueItemSizeLimitedPriorityQueue();
    private UniqueItemSizeLimitedPriorityQueue alerts = new UniqueItemSizeLimitedPriorityQueue();
    private String prev = "";
    public SpiderSense addEvent(String event){
        // builder pattern
        events.add(event);
        return this;
    }
    // input param  can be run through an input filter prior to this function
    // weather related data (sky state) only for example for weather events predictions
    public void learn(String in1){
        // simple prediction of an event from the events que :
        if (alerts.contains(in1)){
            spiderSense = true;return;
        }
        // event has occured, remember what lead to it
        if (events.contains(in1)){
            alerts.add(prev);return;
        }
        // nothing happend
        prev = in1;
    }

    public Boolean getSpiderSense() {
        // spider sense is tingling? event predicted?
        Boolean temp = spiderSense; spiderSense = false;
        return temp;
    }
    public ArrayList<String> getAlertsShallowCopy(){
        // return shallow copy of alerts list
        return alerts.getElements();
    }
    public ArrayList<String> getAlertsClone(){
        // return deep copy of alerts list
        DeepCopier dc = new DeepCopier();
        return dc.copyList(alerts.getElements());
    }
    public void clearAlerts(){
        // this can for example prevent war, because say once a month or a year you stop
        // being on alert against a rival
        alerts.clear();
    }
    // side note:
    // use separate spider sense for data learned by hear say in contrast to actual experience
    // as well as lies (false predictions)
}
this is the way :s54:
 

owly

闇の伝説
Staff member
戦闘 コーダー
Swift:
// maps
class Map {
    private var pointDescription:[String:String] = [:]
    private var descriptionPoint:[String:String] = [:]
    private var currentPosition:LGPointInt = LGPointInt()
    private let regexUtil:RegexUtil = RegexUtil()
    func reset() {
        currentPosition.x = 0
        currentPosition.y = 0
    }
    func moveBy(x:Int, y:Int) {
        currentPosition.shift(x: x, y: y)
    }
    func moveTo(location:String) {
        if let safeOptional = descriptionPoint[location]{
            let text:String = safeOptional
            let tempPoint:LGPointInt = regexUtil.intPointRegex(text: text)
            currentPosition.x = tempPoint.x
            currentPosition.y = tempPoint.y
        }
    }
    func write(description:String) {
        let pointStr = currentPosition.toString()
        pointDescription[pointStr] = description
        descriptionPoint[description] = pointStr
    }
    func read() -> String {
        return pointDescription[currentPosition.toString()] ?? "null"
    }
    func read(p1:LGPointInt) -> String {
        // used for predition
        return pointDescription[p1.toString()] ?? "null"
    }
    func read(description:String) -> String {
        return descriptionPoint[description] ?? "null"
    }
}
 

fukurou

the supreme coder
ADMIN
Java:
package AXJava;

import LivinGrimoire.LGPointInt;
import LivinGrimoire.RegexUtil;

import java.awt.*;
import java.util.Hashtable;

public class Map {
    private Hashtable<String,String> pointDescription = new Hashtable<>();
    private Hashtable<String,String> descriptionPoint = new Hashtable<>();
    private LGPointInt currentPosition = new LGPointInt();
    private RegexUtil regexUtil = new RegexUtil();
    public void reset(){
        // sleep location is considered (0,0) location
        currentPosition.reset();
    }
    public void moveBy(int x, int y){
        // shift current position
        currentPosition.moveBy(x,y);
    }
    public void moveTo(String location){
        // use this when the AI is returning home
        if(descriptionPoint.contains(location)){
            String value = descriptionPoint.get(location);
            Point p1 = regexUtil.pointRegex(value);
            LGPointInt temp = new LGPointInt(p1);
            currentPosition.x = temp.x;
            currentPosition.y = temp.y;
        }
    }
    public void write(String description){
        // location name or item description will be
        // saved on the map on the current point position
        String pointStr = currentPosition.toString();
        pointDescription.put(pointStr, description);
        descriptionPoint.put(description,pointStr);
    }
    public String read(){
        // read place description
        return pointDescription.getOrDefault(currentPosition.toString(),"null");
    }
    public String read(LGPointInt p1){
        // used for predition of upcoming locations
        return pointDescription.getOrDefault(p1.toString(),"null");
    }
    public String read(String description){
        // get location coordinate
        return descriptionPoint.getOrDefault(description, "null");
    }
}
:s53:
 
Top