👨‍💻 dev get ready for a crazy assed coding party

development

owly

闇の伝説
Staff member
戦闘 コーダー
the party will take place in my pants, me and my big cock will be there

DrawRnd (update)
DrawRndDigits(new)
DeepCopier(update)
DiBurper
DiArduino1
DiPetv3
DiSneezer
DiPetv2(deprecate)

@fukurou
 
Last edited by a moderator:

fukurou

the supreme coder
ADMIN
Python:
class DrawRnd:
    # draw a random element, then take said element out
    def __init__(self, *values: str):
        self.converter: LGTypeConverter = LGTypeConverter()
        self.strings: LGFIFO = LGFIFO()
        self._stringsSource: list[str] = []
        for i in range(0, len(values)):
            self.strings.insert(values[i])
            self._stringsSource.append(values[i])

    def addElement(self, element: str):
        self.strings.insert(element)
        self._stringsSource.append(element)

    def drawAndRemove(self) -> str:
        temp: str = self.strings.getRNDElement()
        self.strings.removeItem(temp)
        return temp

    def drawAsIntegerAndRemove(self) -> int:
        temp: str = self.strings.getRNDElement()
        if temp is None:
            return 0
        self.strings.removeItem(temp)
        return self.converter.convertToInt(temp)

    def getSimpleRNDNum(self, lim: int) -> int:
        return random.randint(0, lim)

    def reset(self):
        self.strings.clear()
        for t in self._stringsSource:
            self.strings.insert(t)


class DrawRndDigits:
    # draw a random integer, then take said element out
    def __init__(self, *values: int):
        self.strings: LGFIFO = LGFIFO()
        self._stringsSource: list[int] = []
        for i in range(0, len(values)):
            self.strings.insert(values[i])
            self._stringsSource.append(values[i])

    def addElement(self, element: int):
        self.strings.insert(element)
        self._stringsSource.append(element)

    def drawAndRemove(self) -> int:
        temp: int = self.strings.getRNDElement()
        self.strings.removeItem(temp)
        return temp

    def getSimpleRNDNum(self, lim: int) -> int:
        return random.randint(0, lim)

    def reset(self):
        self.strings.clear()
        for t in self._stringsSource:
            self.strings.insert(t)
 

fukurou

the supreme coder
ADMIN
Python:
class DeepCopier:
    def copyList(self, original: list[str]) -> list[str]:
        deepCopy: list[str] = []
        for item in original:
            deepCopy.append(item)
        return deepCopy

    def copyListOfInts(self, original: list[int]) -> list[int]:
        deepCopy: list[int] = []
        for item in original:
            deepCopy.append(item)
        return deepCopy
 

fukurou

the supreme coder
ADMIN
Python:
class DiBurper(DiSkillV2):
    def __init__(self, burps_per_hour: int):
        self._burpsPerHour = 2
        if 60 > burps_per_hour > 0:
            self._burpsPerHour = burps_per_hour
        self._trgMinute: TrgMinute = TrgMinute()
        self._trgMinute.setMinute(0)
        self._responder1: Responder = Responder("burp", "burp2", "burp3")
        self._draw: DrawRndDigits = DrawRndDigits()
        self._burpMinutes: LGFIFO = LGFIFO()
        self._pl:PlayGround = PlayGround()
        for i in range(1,60):
            self._draw.addElement(i)
        for i in range(0,burps_per_hour):
            self._burpMinutes.insert(self._draw.drawAndRemove())
        super().__init__()

    # Override
    def input(self, ear: str, skin: str, eye: str):
        # night? do not burp
        if self._pl.partOfDay() == "night":
            return
        # reset burps
        if self._trgMinute.trigger():
            self._burpMinutes.clear()
            self._draw.reset()
            for i in range(0, self._burpsPerHour):
                self._burpMinutes.insert(self._draw.drawAndRemove())
            return
        # burp
        now_minutes:int = self._pl.getMinutesAsInt()
        if self._burpMinutes.contains(now_minutes):
            self._burpMinutes.removeItem(now_minutes)
            self._outAlg = self._diSkillUtils.simpleVerbatimAlgorithm("burp", self._responder1.getAResponse())
 

fukurou

the supreme coder
ADMIN
Python:
class DiSneezer(DiSkillV2):
    # the skill simulates sneezing as a result of cold temperature
    def __init__(self, sneezes_per_hour: int):
        self._sneezesPerHour = 2
        if 60 > sneezes_per_hour > 0:
            self._sneezesPerHour = sneezes_per_hour
        self._trgMinute: TrgMinute = TrgMinute()
        self._trgMinute.setMinute(0)
        self._responder1: Responder = Responder("sneeze","achoo", "atchoo", "achew", "atisshoo")
        self._draw: DrawRndDigits = DrawRndDigits()
        self._sneezeMinutes: LGFIFO = LGFIFO()
        self._pl:PlayGround = PlayGround()
        for i in range(1,60):
            self._draw.addElement(i)
        for i in range(0,sneezes_per_hour):
            self._sneezeMinutes.insert(self._draw.drawAndRemove())
        super().__init__()

    # Override
    def input(self, ear: str, skin: str, eye: str):
        # reset sneezes
        if ear.__contains__("cold"):
            self._sneezeMinutes.clear()
            self._draw.reset()
            for i in range(0, self._sneezesPerHour):
                self._sneezeMinutes.insert(self._draw.drawAndRemove())
            return
        # burp
        now_minutes:int = self._pl.getMinutesAsInt()
        if self._sneezeMinutes.contains(now_minutes):
            self._sneezeMinutes.removeItem(now_minutes)
            self._outAlg = self._diSkillUtils.simpleVerbatimAlgorithm("sneeze", self._responder1.getAResponse())

 

fukurou

the supreme coder
ADMIN
Java:
public class DiPetV3 extends DiSkillV2 {
    // chirp, learn replies and reply back occasionally.
    private int chirpsLim = 2;
    private TrgMinute trgMinute = new TrgMinute(0);
    private Responder1Word responder1 = new Responder1Word();
    private DrawRndDigits allMinutes = new DrawRndDigits();
    private LGFIFO<Integer> chirpMinutes = new LGFIFO<>();
    private PlayGround pl = new PlayGround();
    public DiPetV3(int chirpsLim) {
        super();
        if((chirpsLim >0)&& (chirpsLim <60)){
            this.chirpsLim = chirpsLim;
        }
        for (int i = 1; i < 60; i++) {
            allMinutes.addElement(i);
        }
        for (int i = 0; i < this.chirpsLim; i++) {
            chirpMinutes.add(allMinutes.draw());
        }
    }

    @Override
    public void input(String ear, String skin, String eye) {
        // night? return;
        if (pl.partOfDay().equals("night")){
            return;
        }
        // reset chirps as hoyr starts
        if (trgMinute.trigger()){
            chirpMinutes.clear();
            allMinutes.reset();
            for (int i = 0; i <chirpsLim ; i++) {
                chirpMinutes.add(allMinutes.draw());
            }
            return;
        }
        // chirp
        int nowMinutes = pl.getMinutesAsInt();
        if(chirpMinutes.contains(nowMinutes)){
            chirpMinutes.removeItem(nowMinutes);
            this.outAlg = this.diSkillUtils.simpleVerbatimAlgorithm("petv3",responder1.getAResponse());
            return;
        }
        // chirp back to input
        if(responder1.contains(ear)){
            int n = allMinutes.getSimpleRNDNum(100);
            if (n<35){
                this.outAlg = this.diSkillUtils.simpleVerbatimAlgorithm("burp_hkn",responder1.getAResponse());
            }
        }
        // listen n learn recent single words
        responder1.listen(ear);
    }
}
 
Last edited:
Top