spermin'

fukurou

the supreme coder
ADMIN
Python:
import time

class SkillChecker:
    def __init__(self, N):
        self.N = N * 60  # Convert minutes to seconds
        self.in1 = ""
        self.last_check_time = time.time()
        self.reset_flag = False
        self.result = 0

    def standBy(self, in1: str) -> int:
        current_time = time.time()
        if current_time - self.last_check_time >= self.N:
            if self.reset_flag:
                self.result = -1
            else:
                self.result = 1
            self.reset_flag = False
            self.last_check_time = current_time
        if in1 != "":
            self.reset_flag = True
        return self.result

# Example usage
checker = SkillChecker(1)  # N is 1 minute
print(checker.standBy(""))  # Should return 0 initially
time.sleep(65)  # Wait for more than N minutes
print(checker.standBy(""))  # Should return 1 if no input was given
print(checker.standBy("input"))  # Should return -1 if input was given
 

fukurou

the supreme coder
ADMIN
Python:
import time

class StandByCHK:
    def __init__(self, N: int):
        self.N: int = N * 60  # Convert minutes to seconds
        self.in1: str = ""
        self.last_check_time: float = time.time()
        self.reset_flag: bool = False
        self.result: int = 0

    def standBy(self, in1: str) -> int:
        current_time: float = time.time()
        if current_time - self.last_check_time >= self.N:
            if self.reset_flag:
                self.result = -1
            else:
                self.result = 1
            self.reset_flag = False
            self.last_check_time = current_time
        if in1 != "":
            self.reset_flag = True
        return self.result

# Example usage
checker = StandByCHK(1)  # N is 1 minute
print(checker.standBy(""))  # Should return 0 initially
time.sleep(65)  # Wait for more than N minutes
print(checker.standBy(""))  # Should return 1 if no input was given
print(checker.standBy("input"))  # Should return -1 if input was given
 

fukurou

the supreme coder
ADMIN
Python:
import time

class StandByCHK:
    def __init__(self, N: int):
        self.N: int = N * 60  # Convert minutes to seconds
        self.in1: str = ""
        self.last_check_time: float = time.time()
        self.reset_flag: bool = False
        self.result: int = 0

    def standBy(self, in1: str) -> int:
        current_time: float = time.time()
        if current_time - self.last_check_time >= self.N:
            if self.reset_flag:
                self.result = -1  # No stand by mode engagement
            else:
                self.result = 1  # Stand by mode engaged
            self.reset_flag = False
            self.last_check_time = current_time
        elif self.result == 0:
            self.result = 0  # Pending
        if in1 != "":
            self.reset_flag = True
        return self.result

# Example usage
checker = StandByCHK(1)  # N is 1 minute
print(checker.standBy(""))  # Should return 0 initially
time.sleep(65)  # Wait for more than N minutes
print(checker.standBy(""))  # Should return 1 if no input was given
print(checker.standBy("input"))  # Should return -1 if input was given
 

fukurou

the supreme coder
ADMIN
Python:
standby = true



if not param is ""

 standby = false



if trgEveryNMinutes:

 if not standby: standby = true;return -1

 return -1

return 0
 

fukurou

the supreme coder
ADMIN
Python:
from AXPython import *

class StandByCHK:
    def __init__(self, N: int):
        self.cycler: Cycler = Cycler(N)
        self.standBy: bool = True
    def chkStandBy(self, in1: str) -> int:
        if len(in1) > 1:
            self.standBy = False
        x1 = self.cycler.cycleCount()
        print(f'cycler:{x1}')
        if x1 == 0:
            if not self.standBy:
                self.standBy = True
                return -1  # not stand by
            return 1 # stand by
        return 0  # pending
 
Top