👨‍💻 dev on today's jizzfest

development

owly

闇の伝説
Staff member
戦闘 コーダー
Python:
if __name__ == '__main__':
    rcb: RailChatBot = RailChatBot()

    # Learning phase
    for item in ["one", "2", "3", "4", "5", "6"]:
        rcb.learn(item)

    temp: UniqueItemsPriorityQue = UniqueItemsPriorityQue()

    # Respond and insert initial monolog
    n = rcb.respondMonolog("one")
    print(n)
    temp.insert(n)

    # This for loop prints numbers from 1 to 5
    for i in range(1, 6):
        n = rcb.monolog()
        print(n)
        temp.insert(n)

    rcbResult = RailChatBot(1)
    rcbResult.learn("one")

    # Poll and learn from the queue
    n = temp.poll()
    while len(n) > 0:
        rcbResult.learn(n)
        n = temp.poll()

    # Final monolog responses
    print(rcbResult.respondMonolog("one"))
    for i in range(1, 6):
        n = rcbResult.monolog()
        print(n)

    print("hello")

On a larger scale, the coder seems to be aiming to create a chatbot system that can learn from interactions and generate responses based on learned data. Here's a broader perspective on the goals:

1. **Learning and Responding**: The `RailChatBot` instances are designed to learn from given inputs and generate responses. This mimics how chatbots gather information and use it to provide relevant answers.

2. **Priority Queue Management**: The use of `UniqueItemsPriorityQue` suggests that the coder wants to manage responses in a prioritized manner. This could be useful for handling important or frequently asked questions more efficiently.

3. **Interaction Simulation**: By having the chatbot respond to monologs and insert responses into a queue, the coder is simulating a conversation flow. This helps in testing how the chatbot handles different inputs and manages its responses.

4. **Data Processing**: The while loop that processes items from the queue and has the chatbot learn from them indicates a focus on continuous learning and improvement. This is crucial for developing a chatbot that can adapt and provide better responses over time.

Overall, the coder is likely working on a sophisticated chatbot system that can learn, prioritize, and respond effectively, aiming for a more intelligent and interactive user experience.
 

fukurou

the supreme coder
ADMIN
the results seem low reaching if its just 1 result rcb...
what if it were a pool of contexts?

1
2
3
N
there is a start point and an endpoint
but these can be dynamic or static
 

owly

闇の伝説
Staff member
戦闘 コーダー
hmm, yeah the room is going to rick of jizz with this thread.
per trg:route (+,-)/+
 

owly

闇の伝説
Staff member
戦闘 コーダー
with the simple route case its the same but, the params need extraction.

for the 1st the trg is the trg.
for the jizzer the trg is a question or event. up to the skill
 

fukurou

the supreme coder
ADMIN
paths: {key,RCB}
trg?, getPath(params)->?/rcb/queue(+queue to rcb func)
if not MainRCB -> use default

 

fukurou

the supreme coder
ADMIN
Python:
from collections import deque
from typing import List, Optional

class CityMap:
    def __init__(self, n: int):
        self.streets: dict[str, deque[str]] = {}
        self.n: int = n

    def add_street(self, current_street: str, new_street: str) -> None:
        if current_street not in self.streets:
            self.streets[current_street] = deque(maxlen=self.n)
        if new_street not in self.streets:
            self.streets[new_street] = deque(maxlen=self.n)
        
        self.streets[current_street].append(new_street)
        self.streets[new_street].append(current_street)

    def find_path(self, start_street: str, goal_street: str, avoid_street: str, max_length: int = 4) -> Optional[List[str]]:
        queue: deque[tuple[str, List[str]]] = deque([(start_street, [start_street])])
        visited: set[str] = set([start_street])
        while queue:
            current_street, path = queue.popleft()
            if len(path) > max_length:
                return None
            if current_street == goal_street:
                return path
            for neighbor in self.streets[current_street]:
                if neighbor not in visited and neighbor != avoid_street:
                    queue.append((neighbor, path + [neighbor]))
                    visited.add(neighbor)
        return None

    def get_random_street(self, current_street: str) -> Optional[str]:
        if current_street in self.streets and self.streets[current_street]:
            return random.choice(list(self.streets[current_street]))
        return None

    def create_city_map_from_path(self, path: List[str]) -> 'CityMap':
        new_city_map = CityMap(n=1)
        for i in range(len(path) - 1):
            new_city_map.add_street(path[i], path[i + 1])
        return new_city_map

# Example usage
city_map = CityMap(n=2)
city_map.add_street('Street 1', 'Street 2')
city_map.add_street('Street 1', 'Street 3')
city_map.add_street('Street 1', 'Street 4')  # This will push out 'Street 2' from 'Street 1's queue
city_map.add_street('Street 2', 'Street 5')
city_map.add_street('Street 3', 'Street 6')
city_map.add_street('Street 4', 'Street 6')

print("Path from Street 1 to Street 6 avoiding 'Street 4' with max length 4:")
path = city_map.find_path('Street 1', 'Street 6', 'Street 4', max_length=4)
print("Path:", path)

print("\nRandom street connected to 'Street 1':")
random_street = city_map.get_random_street('Street 1')
print("Random Street:", random_street)
 

fukurou

the supreme coder
ADMIN
Python:
# This is a sample Python script.
import random

from AXPython import RailChatBot, UniqueItemsPriorityQue

# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
from collections import deque
from collections import deque
from typing import List, Optional

class CityMap:
    def __init__(self, n: int):
        self.streets: dict[str, deque[str]] = {}
        self.n: int = n

    def add_street(self, current_street: str, new_street: str) -> None:
        if current_street not in self.streets:
            self.streets[current_street] = deque(maxlen=self.n)
        if new_street not in self.streets:
            self.streets[new_street] = deque(maxlen=self.n)

        self.streets[current_street].append(new_street)
        self.streets[new_street].append(current_street)

    def find_path(self, start_street: str, goal_street: str, avoid_street: str, max_length: int = 4) -> Optional[
        List[str]]:
        queue: deque[tuple[str, List[str]]] = deque([(start_street, [start_street])])
        visited: set[str] = {start_street}
        while queue:
            current_street, path = queue.popleft()
            if len(path) > max_length:
                return None
            if current_street == goal_street:
                return path
            for neighbor in self.streets[current_street]:
                if neighbor not in visited and neighbor != avoid_street:
                    queue.append((neighbor, path + [neighbor]))
                    visited.add(neighbor)
        return None

    def get_random_street(self, current_street: str) -> str:
        if current_street in self.streets and self.streets[current_street]:
            return random.choice(list(self.streets[current_street]))
        return ""

    def get_first_street(self, current_street: str) -> str:
        if current_street in self.streets and self.streets[current_street]:
            return self.streets[current_street][0]
        return ""

    def create_city_map_from_path(self, path: List[str]) -> 'CityMap':
        new_city_map = CityMap(n=1)
        for i in range(len(path) - 1):
            new_city_map.add_street(path[i], path[i + 1])
        return new_city_map

# Press the green button in the gutter to run the script.
if __name__ == '__main__':
    city_map = CityMap(n=2)
    city_map.add_street('Street 1', 'Street 2')
    city_map.add_street('Street 1', 'Street 3')
    city_map.add_street('Street 1', 'Street 4')  # This will push out 'Street 2' from 'Street 1's queue
    city_map.add_street('Street 2', 'Street 5')
    city_map.add_street('Street 3', 'Street 6')
    city_map.add_street('Street 4', 'Street 6')

    print("Path from Street 1 to Street 6 avoiding 'Street 4' with max length 4:")
    path = city_map.find_path('Street 1', 'Street 6', 'Street 4', max_length=4)
    print("Path:", path)

    print("\nRandom street connected to 'Street 1':")
    random_street = city_map.get_random_street('Street 1')
    print("Random Street:", random_street)

    print("\nFirst street connected to 'Street 1':")
    first_street = city_map.get_first_street('Street 1')
    print("First Street:", first_street)

# See PyCharm help at https://www.jetbrains.com/help/pycharm/
 

fukurou

the supreme coder
ADMIN
Python:
# This is a sample Python script.
import random

# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
from collections import deque
from typing import List

class CityMap:
    def __init__(self, n: int):
        self.streets: dict[str, deque[str]] = {}
        self.n: int = n
        self.lastInp:str = "standby"

    def add_street(self, current_street: str, new_street: str) -> None:
        if current_street not in self.streets:
            self.streets[current_street] = deque(maxlen=self.n)
        if len(new_street) == 0:
            return
        if new_street not in self.streets:
            self.streets[new_street] = deque(maxlen=self.n)

        self.streets[current_street].append(new_street)
        self.streets[new_street].append(current_street)

    def learn(self, inp: str):
        if inp == self.lastInp:
            return
        self.add_street(self.lastInp, inp)
        self.lastInp = inp

    def find_path(self, start_street: str, goal_street: str, avoid_street: str, max_length: int = 4) -> List[str]:
        if start_street not in self.streets:
            return []
        queue: deque[tuple[str, List[str]]] = deque([(start_street, [start_street])])
        visited: set[str] = {start_street}
        while queue:
            current_street, path = queue.popleft()
            if len(path) > max_length:
                return []
            if current_street == goal_street:
                return path
            for neighbor in self.streets[current_street]:
                if neighbor not in visited and neighbor != avoid_street:
                    queue.append((neighbor, path + [neighbor]))
                    visited.add(neighbor)
        return []

    def get_random_street(self, current_street: str) -> str:
        if current_street in self.streets and self.streets[current_street]:
            return random.choice(list(self.streets[current_street]))
        return ""

    def get_first_street(self, current_street: str) -> str:
        if current_street in self.streets and self.streets[current_street]:
            return self.streets[current_street][0]
        return ""

    def create_city_map_from_path(self, path: List[str]) -> 'CityMap':
        new_city_map = CityMap(n=1)
        for i in range(len(path) - 1):
            new_city_map.add_street(path[i], path[i + 1])
        return new_city_map

# Press the green button in the gutter to run the script.
if __name__ == '__main__':
    city_map = CityMap(n=2)
    city_map.learn('Street 1')
    city_map.learn('Street 2')
    city_map.learn('Street 5')
    city_map.learn('Street 2')
    city_map.learn('Street 1')
    city_map.learn('Street 3')
    city_map.learn('Street 6')
    city_map.learn('Street 3')
    city_map.learn('Street 1')
    city_map.learn('Street 4')
    city_map.learn('Street 6')

    # city_map.add_street('Street 1', 'Street 2')
    # city_map.add_street('Street 1', 'Street 3')
    # city_map.add_street('Street 1', 'Street 4')  # This will push out 'Street 2' from 'Street 1's queue
    # city_map.add_street('Street 2', 'Street 5')
    # city_map.add_street('Street 3', 'Street 6')
    # city_map.add_street('Street 4', 'Street 6')

    print("Path from Street 1 to Street 6 avoiding 'Street 4' with max length 4:")
    path = city_map.find_path('Street 1', 'Street 6', 'Street 3', max_length=4)
    print("Path:", path)

    print("\nRandom street connected to 'Street 1':")
    random_street = city_map.get_random_street('Street 1')
    print("Random Street:", random_street)

    print("\nFirst street connected to 'Street 1':")
    first_street = city_map.get_first_street('Street 1')
    print("First Street:", first_street)
    print('experiment:')
    city_map.add_street('Street 1', '')
    first_street = city_map.get_first_street('Street 1')
    print("First Street:", first_street)

# See PyCharm help at https://www.jetbrains.com/help/pycharm/
 

fukurou

the supreme coder
ADMIN
Python:
# This is a sample Python script.
import random

# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
from collections import deque
from typing import List

class CityMap:
    def __init__(self, n: int):
        self.streets: dict[str, deque[str]] = {}
        self.n: int = n
        self.lastInp:str = "standby"

    def add_street(self, current_street: str, new_street: str) -> None:
        if current_street not in self.streets:
            self.streets[current_street] = deque(maxlen=self.n)
        if len(new_street) == 0:
            return
        if new_street not in self.streets:
            self.streets[new_street] = deque(maxlen=self.n)

        self.streets[current_street].append(new_street)
        self.streets[new_street].append(current_street)

    def add_streets_from_string(self, current_street: str, streets_string: str) -> None:
        streets = streets_string.split('_')
        for street in streets:
            self.add_street(current_street, street)

    def learn(self, inp: str):
        if inp == self.lastInp:
            return
        self.add_street(self.lastInp, inp)
        self.lastInp = inp

    def find_path(self, start_street: str, goal_street: str, avoid_street: str, max_length: int = 4) -> List[str]:
        if start_street not in self.streets:
            return []
        queue: deque[tuple[str, List[str]]] = deque([(start_street, [start_street])])
        visited: set[str] = {start_street}
        while queue:
            current_street, path = queue.popleft()
            if len(path) > max_length:
                return []
            if current_street == goal_street:
                return path
            for neighbor in self.streets[current_street]:
                if neighbor not in visited and neighbor != avoid_street:
                    queue.append((neighbor, path + [neighbor]))
                    visited.add(neighbor)
        return []

    def get_random_street(self, current_street: str) -> str:
        if current_street in self.streets and self.streets[current_street]:
            return random.choice(list(self.streets[current_street]))
        return ""

    def get_streets_string(self, street: str) -> str:
        if street in self.streets and self.streets[street]:
            return '_'.join(self.streets[street])
        return ""

    def get_first_street(self, current_street: str) -> str:
        if current_street in self.streets and self.streets[current_street]:
            return self.streets[current_street][0]
        return ""

    def create_city_map_from_path(self, path: List[str]) -> 'CityMap':
        new_city_map = CityMap(n=1)
        for i in range(len(path) - 1):
            new_city_map.add_street(path[i], path[i + 1])
        return new_city_map

# Press the green button in the gutter to run the script.
if __name__ == '__main__':
    city_map = CityMap(n=3)
    city_map.add_streets_from_string('Street 1', "Street 2_Street 3_Street 4")
    # city_map.learn('Street 1')
    # city_map.learn('Street 2')
    # city_map.learn('Street 5')
    # city_map.learn('Street 2')
    # city_map.learn('Street 1')
    # city_map.learn('Street 3')
    # city_map.learn('Street 6')
    # city_map.learn('Street 3')
    # city_map.learn('Street 1')
    # city_map.learn('Street 4')
    # city_map.learn('Street 6')

    # city_map.add_street('Street 1', 'Street 2')
    # city_map.add_street('Street 1', 'Street 3')
    # city_map.add_street('Street 1', 'Street 4')  # This will push out 'Street 2' from 'Street 1's queue
    city_map.add_street('Street 2', 'Street 5')
    city_map.add_street('Street 3', 'Street 6')
    city_map.add_street('Street 4', 'Street 6')

    print("Path from Street 1 to Street 6 avoiding 'Street 4' with max length 4:")
    path = city_map.find_path('Street 1', 'Street 6', 'Street 3', max_length=4)
    print("Path:", path)

    print("\nRandom street connected to 'Street 1':")
    random_street = city_map.get_random_street('Street 1')
    print("Random Street:", random_street)

    print("\nFirst street connected to 'Street 1':")
    first_street = city_map.get_first_street('Street 1')
    print("First Street:", first_street)
    print('experiment:')
    city_map.add_street('Street 1', '')
    first_street = city_map.get_first_street('Street 1')
    print("First Street:", first_street)
    print(city_map.get_streets_string("Street 1"))

# See PyCharm help at https://www.jetbrains.com/help/pycharm/
 
Top