sleep dev

fukurou

the supreme coder
ADMIN
Java:
package Skills.logical;

import Auxiliary_Modules.Responder;
import Auxiliary_Modules.TimeGate;
import LivinGrimoire.Mutatable;

public class APSleep extends Mutatable {
    protected TimeGate timeGate = new TimeGate();
    public Responder wakeners;
    public Boolean done = false;

    public APSleep(Responder wakeners) {
        this.wakeners = wakeners;
    }

    @Override
    public String action(String ear, String skin, String eye) {
        if (wakeners.responsesContainsStr(ear) || timeGate.isClosed()){
            done = true;
            return "waking up";
        }
        if (!ear.isEmpty()){return "zzz";}
        return "";
    }

    @Override
    public Boolean completed() {
        return done;
    }
}
jizm
 

fukurou

the supreme coder
ADMIN
Java:
package Skills.logical;

import Auxiliary_Modules.Responder;
import Auxiliary_Modules.TimeGate;
import LivinGrimoire.Mutatable;

public class APSleep extends Mutatable {
    protected TimeGate timeGate = new TimeGate();
    public Responder wakeners;
    public Boolean done = false;

    public APSleep(Responder wakeners, int sleep_minutes) {
        this.wakeners = wakeners;
        timeGate.openGate();
        timeGate.setPause(sleep_minutes);
    }

    @Override
    public String action(String ear, String skin, String eye) {
        if (wakeners.responsesContainsStr(ear) || timeGate.isClosed()){
            done = true;
            return "waking up";
        }
        if (!ear.isEmpty()){return "zzz";}
        return "";
    }

    @Override
    public Boolean completed() {
        return done;
    }
}
 

fukurou

the supreme coder
ADMIN
Java:
package Skills.logical;

import Auxiliary_Modules.Responder;
import LivinGrimoire.APVerbatim;
import LivinGrimoire.DiSkillV2;
import LivinGrimoire.Mutatable;

import java.util.ArrayList;
import java.util.Objects;

public class DiSleep extends DiSkillV2 {
    private final int sleep_duration_minutes;
    private final Responder wakeners;
    // trgtime
    public DiSleep(int sleep_duration_minutes, Responder wakeners) {
        this.sleep_duration_minutes = sleep_duration_minutes;
        this.wakeners = wakeners;
    }

    @Override
    public void input(String ear, String skin, String eye) {
        if(ear.equals("sleep")){
            APVerbatim announce = new APVerbatim("initializing sleep");
            APSleep apSleep = new APSleep(wakeners, sleep_duration_minutes);
            this.algPartsFusion(2,announce,apSleep);
        }
    }
}
 

fukurou

the supreme coder
ADMIN
Java:
package Skills.logical;

import Auxiliary_Modules.Responder;
import Auxiliary_Modules.TrgTime;
import LivinGrimoire.APVerbatim;
import LivinGrimoire.DiSkillV2;
import LivinGrimoire.Mutatable;

import java.util.ArrayList;
import java.util.Objects;

public class DiSleep extends DiSkillV2 {
    private final int sleep_duration_minutes;
    private final Responder wakeners;
    private TrgTime trgTime = new TrgTime();
    // trgtime
    public DiSleep(int sleep_duration_minutes, Responder wakeners) {
        this.sleep_duration_minutes = sleep_duration_minutes;
        this.wakeners = wakeners;
        trgTime.setTime("00:00");
    }

    public DiSleep setTrgTime(String sleep_time_stamp) {
        this.trgTime.setTime(sleep_time_stamp);
        return this;
    }

    @Override
    public void input(String ear, String skin, String eye) {
        if(trgTime.alarm()){
            APVerbatim announce = new APVerbatim("initializing sleep");
            APSleep apSleep = new APSleep(wakeners, sleep_duration_minutes);
            this.algPartsFusion(2,announce,apSleep);
        }
    }
}
 

fukurou

the supreme coder
ADMIN
Python:
class APSleep(Mutatable):
    def __init__(self, wakeners, sleep_minutes):
        super().__init__()  # Call the constructor of the parent class (Mutatable)
        self.wakeners: Responder = wakeners
        self.done: bool = False
        self.timeGate: TimeGate = TimeGate(sleep_minutes)
        self.timeGate.openForPauseMinutes()

    def action(self, ear, skin, eye):
        if self.wakeners.responsesContainsStr(ear) or self.timeGate.isClosed():
            self.done = True
            return "i am awake"
        if ear:
            return "zzz"
        return ""

    def completed(self):
        return self.done


class DiSleep(DiSkillV2):
    def __init__(self, sleep_duration_minutes, wakeners):
        super().__init__()  # Call the superclass constructor
        self.sleep_duration_minutes = sleep_duration_minutes
        self.wakeners: Responder = wakeners
        self.trgTime: TrgTime = TrgTime()
        self.trgTime.setTime("00:00")

    def set_sleep_time_stamp(self, sleep_time_stamp: str):
        self.trgTime.setTime(sleep_time_stamp)
        return self

    def input(self, ear, skin, eye):
        if self.trgTime.alarm():
            announce: APVerbatim = APVerbatim("initializing sleep")
            ap_sleep: APSleep = APSleep(self.wakeners, self.sleep_duration_minutes)
            self.algPartsFusion(2, announce, ap_sleep)
 
Top