go home skill

fukurou

Administrator

alg:

c2=0
standby?{bot at home?{mode=1;c2=0}else
switch mode:
1: go home;mode=2
2:if c2>x{c2=0;go home}

standby boolean will be retrieved soulisticsly}

 

fukurou

Administrator
var location:=null //home
var homeDefcon
alterHomesList
*hotels

explore mode?

c2=0

standby?{bot at home?{mode=1;c2=0}else

switch mode:

1: go home;mode=2 //*home not null ?

2:if c2>x{c2=0;go home}



standby boolean will be retrieved soulisticsly}
 

fukurou

Administrator
{var location:=null //home
var homeDefcon}
alterHomesList(sorted)
*hotels

(night)time ?
check defcon
set algMode
home?
set algMode
else default mode

go to new explore location
********************************************
explore mode?
count standbys while defcon ok
if >x, set home and alterhome 2hours
update defcon
if bad defcon and at explore location, delete explore location(set to home var), go home, default mode
************************************************
defend
***************************************************
vacation mode
***************************************************
default mode
c2=0

standby?{bot at home?{mode=1;c2=0}else

switch mode:

1: go home;mode=2 //*home not null ?

2:if c2>x{c2=0;go home}



standby boolean will be retrieved soulisticsly}
 

fukurou

Administrator
{var location:=null //home
var homeDefcon}
alterHomesList(sorted)
*hotels

manual setHome

input : plain(shaded) : add to possible alter homeList
(night)time ?
check defcon
set algMode
home?
set algMode
else default mode

*********************************************
purchase/rent (depends on resources)
build
go to new explore location
********************************************
explore mode?
count standbys while defcon ok
if >x, set home and alterhome 2hours
update defcon
if bad defcon delete explore location(set to home var), go home, default mode
************************************************
defend
***************************************************
vacation mode
***************************************************
default mode
c2=0

standby?{bot at home?{mode=1;c2=0}else

switch mode:

1: go home;mode=2 //*home not null ?

2:if c2>x{c2=0;go home}



standby boolean will be retrieved soulisticsly}
 

fukurou

Administrator
created the skill class : level 2 auto skill : can engage with time or user only
updated soul and chobit class to handle standby phase
tested : ok
 

fukurou

Administrator
Java:
package chobit;

import java.util.ArrayList;

public class DIHomer extends DISkill {
    private Coordinate homeXY = new Coordinate(0.0, 0.0);
    private int mode = 0;
    private int c2 = 0; // standBy counter;

    public DIHomer(Kokoro kokoro) {
        super(kokoro);
    }

    @Override
    public void input(String ear, String skin, String eye) {

        if (ear.contains("this is home")) {
            this.homeXY = new Coordinate(Tokoro.lat, Tokoro.lon);
        } // confirmation alg
            // external mode triggers :
        if (this.kokoro.standBy) {
            mode = 1;// need to go home
            if (measure(this.homeXY.getX(), this.homeXY.getY(), 1, 1) < 15) {
                mode = 0;
            }
        }
        switch (mode) {
        case 1:
            // gohome
            mode = 2;

            break;
        case 2:
            c2++;
            if (c2 > 1) {
                c2 = 0;
                // gohomealg2
            }
            break;
        default:
            break;
        }
    }

    @Override
    public void output(Neuron noiron) {
        if (this.kokoro.standBy) {
            // noiron.algParts.add(verbatimGorithm(""));
        }
    }

    @Override
    public Boolean auto() {
        return true;
    }

    private Algorithm verbatimGorithm(AbsAlgPart itte) {
        // returns a simple algorithm for saying sent parameter
        // AbsAlgPart itte = new APVerbatim("I am");
        String representation = "about";
        ArrayList<AbsAlgPart> algParts1 = new ArrayList<>();
        algParts1.add(itte);
        Algorithm algorithm = new Algorithm("about", representation, algParts1);
        return algorithm;
    }

    public Double measure(double lat1, double lon1, double lat2, double lon2) { // generally used geo measurement
        // function
        double R = 6378.137; // Radius of earth in KM
        double dLat = lat2 * Math.PI / 180 - lat1 * Math.PI / 180;
        double dLon = lon2 * Math.PI / 180 - lon1 * Math.PI / 180;
        double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(lat1 * Math.PI / 180)
                * Math.cos(lat2 * Math.PI / 180) * Math.sin(dLon / 2) * Math.sin(dLon / 2);
        double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
        double d = R * c;
        return d * 1000; // meters
    }
}
 

fukurou

Administrator
Java:
package chobit;

import java.util.ArrayList;

public class DIHomer extends DISkill {
    private Coordinate homeXY = new Coordinate(0.0, 0.0);
    private int mode = 0;
    private int c2 = 0; // standBy counter;

    public DIHomer(Kokoro kokoro) {
        super(kokoro);
    }

    @Override
    public void input(String ear, String skin, String eye) {

        if (ear.contains("this is home")) {
            this.homeXY = new Coordinate(Tokoro.lat, Tokoro.lon);
            mode = 3;
        } // confirmation alg
            // external mode triggers :
        if (this.kokoro.standBy) {
            if (measure(this.homeXY.getX(), this.homeXY.getY(), 1, 1) < 15) {
                mode = 0;
                // else if mode !2 mode 1
            } else {
                if (mode != 2) {
                    mode = 1;
                } else {
                    c2++;
                }
            }
        }

    }

    @Override
    public void output(Neuron noiron) {
        switch (mode) {
        case 1:
            noiron.algParts.add(verbatimGorithm(new APVerbatim("i wanna go home")));
            mode = 2;

            break;
        case 2:
            if (c2 > 1) {
                c2 = 0;
                noiron.algParts.add(verbatimGorithm(new APVerbatim("take me home")));
            }
            break;
        case 3:
            noiron.algParts.add(verbatimGorithm(new APVerbatim("yes your majesty")));
            mode = 0;

            break;
        default:
            break;
        }
    }

    @Override
    public Boolean auto() {
        return true;
    }

    private Algorithm verbatimGorithm(AbsAlgPart itte) {
        // returns a simple algorithm for saying sent parameter
        // AbsAlgPart itte = new APVerbatim("I am");
        String representation = "about";
        ArrayList<AbsAlgPart> algParts1 = new ArrayList<>();
        algParts1.add(itte);
        Algorithm algorithm = new Algorithm("about", representation, algParts1);
        return algorithm;
    }

    public Double measure(double lat1, double lon1, double lat2, double lon2) { // generally used geo measurement
        // function
        double R = 6378.137; // Radius of earth in KM
        double dLat = lat2 * Math.PI / 180 - lat1 * Math.PI / 180;
        double dLon = lon2 * Math.PI / 180 - lon1 * Math.PI / 180;
        double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(lat1 * Math.PI / 180)
                * Math.cos(lat2 * Math.PI / 180) * Math.sin(dLon / 2) * Math.sin(dLon / 2);
        double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
        double d = R * c;
        return d * 1000; // meters
    }
}
 

fukurou

Administrator
hmmm... might as well add a distance from here to home function tbh ngl
Double distance = measure(51.4045, 30.0542, 51.4050, 30.06);
String s1 = String.format("%.02f kilometer", distance / 1000);

 

LeFringillidaeDeLaMontagne

Staff member
Administrator
Moderator
but how should it be triggered ?
what spell line should the master say for the AI to output the distance from here to home ?
@LeFéminismeEstLeCancer

how far from here to home : too long
are we there yet : still long

hmmm
@LeFringillidaeDeLaMontagne
fukurou, you should join our Inclupedia project, so then all the information from it can be fed into your AI and it can win at Jeopardy. IBM Watson: The inside story of how the Jeopardy-winning supercomputer was born, and what it wants to do next
 

fukurou

Administrator
Java:
package chobit;

import java.util.ArrayList;

public class DIHomer extends DISkill {
    private Coordinate homeXY = new Coordinate(51.4045, 30.0542);
    // 51.4045, 30.0542
    private int mode = 0;
    private int c2 = 0; // standBy counter;

    public DIHomer(Kokoro kokoro) {
        super(kokoro);
        // DB load home coordinates or default value
    }

    @Override
    public void input(String ear, String skin, String eye) {
        /*
         * the input function contains a trigger list for different modes where
         * different input conditions cause different modes and mode counters
         * modifications
         */
        if (ear.contains("this is home")) {
            this.homeXY = new Coordinate(Tokoro.lat, Tokoro.lon);
            mode = 3; // confirmation alg
            return;
            // DB save home coordinates
        }
        if (ear.contains("homer")) {
            mode = 4;
            return;
        }
            // external mode triggers :
        if (this.kokoro.standBy) {
            if (measure(this.homeXY.getX(), this.homeXY.getY(), Tokoro.lat, Tokoro.lon) < 2000) {
                mode = 0;
                // else if mode !2 mode 1
            } else {
                if (mode != 2) {
                    mode = 1;
                } else {
                    c2++;
                }
            }
        }

    }

    @Override
    public void output(Neuron noiron) {
        /*
         * modes summon different algorithms modes also contain mode changes such as
         * mode reset (mode 0)
         */
        switch (mode) {
        case 1:
            noiron.algParts.add(verbatimGorithm(new APVerbatim("i wanna go home")));
            mode = 2;

            break;
        case 2:
            if (c2 > 1) {
                c2 = 0;
                noiron.algParts.add(verbatimGorithm(new APVerbatim("take me home")));
            }
            break;
        case 3:
            noiron.algParts.add(verbatimGorithm(new APVerbatim("yes your majesty")));
            mode = 0;

            break;
        case 4:
            // measure(this.homeXY.getX(), this.homeXY.getY(), Tokoro.lat, Tokoro.lon)
            Double distance = measure(51.4045, 30.0542, 51.4050, 30.06);
            String s1 = String.format("%.02f kilometer", distance / 1000);
            noiron.algParts.add(verbatimGorithm(new APVerbatim(s1)));
            mode = 0;
            break;
        default:
            break;
        }
    }

    @Override
    public Boolean auto() {
        return true;
    }

    private Algorithm verbatimGorithm(AbsAlgPart itte) {
        // returns a simple algorithm for saying sent parameter
        // AbsAlgPart itte = new APVerbatim("I am");
        String representation = "about";
        ArrayList<AbsAlgPart> algParts1 = new ArrayList<>();
        algParts1.add(itte);
        Algorithm algorithm = new Algorithm("about", representation, algParts1);
        return algorithm;
    }

    public Double measure(double lat1, double lon1, double lat2, double lon2) { // generally used geo measurement
        // function
        double R = 6378.137; // Radius of earth in KM
        double dLat = lat2 * Math.PI / 180 - lat1 * Math.PI / 180;
        double dLon = lon2 * Math.PI / 180 - lon1 * Math.PI / 180;
        double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(lat1 * Math.PI / 180)
                * Math.cos(lat2 * Math.PI / 180) * Math.sin(dLon / 2) * Math.sin(dLon / 2);
        double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
        double d = R * c;
        return d * 1000; // meters
    }
}
 
Top