👨‍💻 dev loop jizz up

development

fukurou

the supreme coder
ADMIN
Python:
import asyncio

async def input_loop():
    while True:
        print("Waiting for input...")
        await asyncio.sleep(2)  # Pauses but allows other async tasks
        print("Loop continues...")

asyncio.run(input_loop())
 

fukurou

the supreme coder
ADMIN
Python:
import time
from livingrimoire import Brain, DiHelloWorld, DiSysOut

if __name__ == '__main__':
    brain = Brain()
    brain.add_logical_skill(DiHelloWorld())
    brain.hardwareChobit.add_continuous_skill(DiSysOut())

    while True:
        user_input = input("> ")

        if user_input.lower() == "exit":
            print("Exiting program...")
            break

        # Process the input through the brain
        brain.think_default(user_input)
        
        # Introduce a short interval for Brain processing
        time.sleep(2)  # Wait for 2 seconds before looping again
 

fukurou

the supreme coder
ADMIN
Python:
import asyncio
from livingrimoire import Brain, DiHelloWorld, DiSysOut

async def main_loop():
    brain = Brain()
    brain.add_logical_skill(DiHelloWorld())
    brain.hardwareChobit.add_continuous_skill(DiSysOut())

    while True:
        user_input = input("> ")  # Get user input

        if user_input.lower() == "exit":
            print("Exiting program...")
            break

        # Process the input through the brain
        brain.think_default(user_input)

        # Introduce a non-blocking interval
        await asyncio.sleep(2)  # Allows other tasks to run instead of freezing

asyncio.run(main_loop())
 

fukurou

the supreme coder
ADMIN
Python:
import sched
import time
from livingrimoire import Brain, DiHelloWorld, DiSysOut

scheduler = sched.scheduler(time.time, time.sleep)

brain = Brain()
brain.add_logical_skill(DiHelloWorld())
brain.hardwareChobit.add_continuous_skill(DiSysOut())

def tick():
    """Runs at intervals without blocking."""
    user_input = input("> ")

    if user_input.lower() == "exit":
        print("Exiting program...")
        return  # Stop scheduling
    
    brain.think_default(user_input)

    scheduler.enter(2, 1, tick)  # Schedule next tick in 2 seconds

scheduler.enter(0, 1, tick)  # Start loop immediately
scheduler.run()
 

fukurou

the supreme coder
ADMIN
Python:
import sched
import time
from livingrimoire import Brain, DiHelloWorld, DiSysOut

def tick(scheduler):
    """Runs at intervals without blocking."""
    user_input = input("> ")

    if user_input.lower() == "exit":
        print("Exiting program...")
        return  # Stop scheduling

    brain.think_default(user_input)

    scheduler.enter(2, 1, tick, (scheduler,))  # Schedule next tick in 2 seconds

if __name__ == '__main__':
    scheduler = sched.scheduler(time.time, time.sleep)

    brain = Brain()
    brain.add_logical_skill(DiHelloWorld())
    brain.hardwareChobit.add_continuous_skill(DiSysOut())

    scheduler.enter(0, 1, tick, (scheduler,))  # Start loop immediately
    scheduler.run()
 
Top