diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a7e06bb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +# Use Python 3.12-slim as the base image +FROM python:3.12-slim + +# Set the working directory in the container +WORKDIR /app + +# Install system dependencies +RUN apt-get update && apt-get install -y \ + git \ + build-essential \ + && rm -rf /var/lib/apt/lists/* + +# Copy requirements file +COPY requirements.txt requirements.txt + +# Upgrade pip and install dependencies +RUN pip install --no-cache-dir -U pip && pip install --no-cache-dir -r requirements.txt + +# Create a fake sudo command to bypass sudo errors +RUN echo '#!/bin/sh\nexec "$@"' > /usr/bin/sudo && chmod +x /usr/bin/sudo + +# Clone and install TemporalLib +RUN git clone --depth 1 https://github.com/TheRandonauts/temporal.git /app/temporal \ + && cd /app/temporal \ + && ./make.sh \ + && rm -rf /app/temporal + +# Copy application files +COPY . . + +# Expose Streamlit's default port +EXPOSE 8501 + +# Run the application +CMD ["streamlit", "run", "main.py", "--server.port=8501", "--server.address=0.0.0.0"] \ No newline at end of file diff --git a/Pipfile b/Pipfile deleted file mode 100644 index d7b1181..0000000 --- a/Pipfile +++ /dev/null @@ -1,15 +0,0 @@ -[[source]] -url = "https://pypi.org/simple" -verify_ssl = true -name = "pypi" - -[packages] -randonautentropy = "*" -questionary = "*" -rich = "*" -lyagushka = {file = "https://github.com/randogoth/lyagushka/releases/download/1.1.1/lyagushka-1.1.1-cp312-cp312-manylinux_2_34_x86_64.whl"} - -[dev-packages] - -[requires] -python_version = "3.12" diff --git a/main.py b/main.py index 7842277..3a22845 100644 --- a/main.py +++ b/main.py @@ -1,10 +1,9 @@ +import streamlit as st +import streamlit.components.v1 as components from lyagushka import Lyagushka -from randonautentropy import rndo +from randonautentropy import temporal import json -import questionary -from rich.console import Console -from rich.text import Text -from rich.progress import Progress, TextColumn, BarColumn +import time # Validate Z-Score def z_thresh(s): @@ -19,105 +18,131 @@ def z_thresh(s): # Generate random data with a specified size and maximum value def generate_random_data(size=1024, max_value=100): random_data = [] - # Calculate the number of bytes required to represent the max value max_value_bytes = (max_value.bit_length() + 7) // 8 max_int_for_bytes = 2**(max_value_bytes * 8) - 1 - # Define the cutoff to ensure uniform distribution mod_cutoff = max_int_for_bytes - (max_int_for_bytes % max_value) - 1 while len(random_data) < size: - # Generate random hexadecimal data - hex_data = rndo.get(length=max_value_bytes * size) - # Process the hex data in chunks + hex_data = temporal.get(length=max_value_bytes * size) for i in (hex_data[j:j + 2 * max_value_bytes] for j in range(0, len(hex_data), 2 * max_value_bytes)): - num = int(i, 16) # Convert hex chunk to integer + num = int(i, 16) if num <= mod_cutoff: - # Add the value to random_data if within the cutoff random_data.append(num % (max_value + 1)) - # Break early if enough data is collected if len(random_data) >= size: break return random_data # Analyze and select numbers based on Z-score -def pull_number(numbers: set, top: int, amount: int, z_score: float): - - # Generate and sort a dataset of random numbers +def pull_number(numbers: set, top: int, amount: int, z_score: float, progress_bar, task_name): dataset = generate_random_data(3000, 999) dataset.sort() - - # Analyze the dataset using Lyagushka zhaba = Lyagushka(dataset) analysis_results = json.loads(zhaba.search(4.0, 30)) - # Filter results for valid Z-scores results = [obj for obj in analysis_results if obj['z_score'] is not None] max_z_score = max(obj['z_score'] for obj in results) - for obj in results: - # Check if the object has the maximum Z-score and meets the threshold + total_tasks = amount - len(numbers) + for idx, obj in enumerate(results): if obj['z_score'] == max_z_score and obj['z_score'] >= z_score: - # Ensure the centroid is not an x.5 and add the scaled value if len(numbers) < amount and (obj['centroid'] % 1 != 0.5): numbers.add(int((obj['centroid'] / 999) * top) + 1) + # Update progress + progress_bar.progress((len(numbers) / amount)) + time.sleep(0.05) # Simulate some delay + if len(numbers) >= amount: + break return numbers -# Main function to drive the lottery draw process -def main(): - - console = Console() - - # Display an introduction to the lottery process - description = "\nEach lottery ball is selected by generating hundreds of random values within the provided range. The data is analyzed to identify number clusters. The centroid values of the attractor clusters with a z-score above the set threshold are selected as lotto numbers. This process repeats until all balls are drawn. The entire method is a one-dimensional analogy to how attractor points are calculated in Randonautica.\n" - console.print(description, style="italic green") +def generate_ball_html(numbers, bonus): + balls_html = "" + for num in numbers: + balls_html += f""" +