Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 4 additions & 17 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,26 +1,13 @@
[flake8]
max-line-length = 88
extend-ignore =
E203, # whitespace before ':'
E501, # line too long (handled by black)
W503, # line break before binary operator
E402, # module level import not at top of file (common in scripts)
exclude =
.git,
__pycache__,
.venv,
venv,
.pytest_cache,
*.egg-info,
build,
dist
# E203 whitespace before ':', E501 line too long (black), W503 line break before
# binary operator, E402 module level import not at top (common in scripts)
extend-ignore = E203,E501,W503,E402
exclude = .git,__pycache__,.venv,venv,.pytest_cache,*.egg-info,build,dist
per-file-ignores =
# Allow longer lines in certain files
*/4x/*.py:E501
*/hive-mind/*.py:E501
# Allow print statements in CLI scripts
*/ant/*.py:T201
*/allseeingeye/*.py:T201
*/mover/*.py:T201
max-complexity = 15
import-order-style = google
31 changes: 30 additions & 1 deletion 4x/colony_management.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
import random
import heapq


class Infrastructure:
"""Base class for colony buildings."""

def __init__(self):
self.cost = {}
self.maintenance = 0


class Colonist:
"""Base class for colonist specialisations."""

def __init__(self):
self.skills = {}


class EnvironmentalHazard:
"""Base class for environmental hazards a colony can suffer."""

def __init__(self):
self.severity = 0


class DefensePlatform:
"""A defensive installation."""

def __init__(self):
self.strength = 1

# Colony management
class Colony:
def __init__(self, name, location, resources, population=100, infrastructure=0):
Expand Down Expand Up @@ -54,7 +83,7 @@ def __init__(self, colony):
self.defense_platforms = []
self.shields = 0

def update(self, time_step):
def update(self, time_step, threats=()):
# Defend against threats
for threat in threats:
if self.engage(threat):
Expand Down
1 change: 1 addition & 0 deletions 4x/tech_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def apply_technology_effects(tech_id: str, game_state: dict):
allocated_resources = optimize_research(tech_tree, resources, strategic_goals)

# Apply technology effects
game_state = {}
for tech_id, cost in allocated_resources.items():
tech_tree.unlock_technology(tech_id)
apply_technology_effects(tech_id, game_state)
1 change: 1 addition & 0 deletions MDtoHTML/formatter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# formatter.py
import tkinter as tk
from tkinter import simpledialog
import webbrowser
import markdown2
Expand Down
1 change: 1 addition & 0 deletions MakeMarkdown/txttomd.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# txttomd.py
import os
import shutil


Expand Down
1 change: 1 addition & 0 deletions ant/ant.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from rich import print
from rich.panel import Panel
import anthropic
Expand Down
1 change: 1 addition & 0 deletions bookmaker/bookmaker.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# bookmaker.py
import os
import time
from harmonized_api_wrappers import APIWrapper

Expand Down
2 changes: 1 addition & 1 deletion bookmaker/harmonized_api_wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def process_claude_model(self, model_info, temperature, system_prompt, refined_i

def process_monster_model(self, model_info, prompt, parameters):
api_key = os.environ.get("MONSTER_API_KEY")
client_instance = MonsterAPI(api_key)
client_instance = client(api_key)
response = client_instance.get_response(model=model_info["name"], data={
"prompt": prompt,
**parameters
Expand Down
1 change: 1 addition & 0 deletions brainstorm/brainstorm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# brainstorm.py
import os
from harmonized_api_wrappers import APIWrapper

def create_new_story():
Expand Down
2 changes: 1 addition & 1 deletion brainstorm/harmonized_api_wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def process_claude_model(self, model_info, temperature, system_prompt, refined_i

def process_monster_model(self, model_info, prompt, parameters):
api_key = os.environ.get("MONSTER_API_KEY")
client_instance = MonsterAPI(api_key)
client_instance = client(api_key)
response = client_instance.get_response(model=model_info["name"], data={
"prompt": prompt,
**parameters
Expand Down
1 change: 1 addition & 0 deletions chatter/chatter-user.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# chatter-user.py
import requests
import json
from datetime import datetime
# Configuration for LLMs, with API key for the third model.
Expand Down
1 change: 1 addition & 0 deletions hive-mind/Z/zhive-mind.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,3 +337,4 @@ def main():
sys.exit(app.exec_())

if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions hive-mind/hive-mind-2/hivemind2.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import logging
import re
import sys
Expand Down
2 changes: 2 additions & 0 deletions hive-mind/hive-mind/hive-mind.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# hive-mind.py
import os
import re
import sys
import logging
import xml.etree.ElementTree as ET
Expand Down
1 change: 1 addition & 0 deletions iPhone toss to Mac/WatchCharm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# WatchCharm.py
import os
import shutil

from watchdog.events import FileSystemEventHandler
Expand Down
3 changes: 2 additions & 1 deletion iPhone toss to Mac/autopy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# autopy.py
import os
import subprocess
import time

Expand Down Expand Up @@ -41,7 +42,7 @@ def on_created(self, event):


if __name__ == "__main__":
path = '/PATH/charm
path = '/PATH/charm'
event_handler = NewFileHandler()
observer = Observer()
observer.schedule(event_handler, path, recursive=False)
Expand Down
1 change: 1 addition & 0 deletions iPhone toss to Mac/mover.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# mover.py
import shutil
from pathlib import Path

# Source directory to monitor
Expand Down
1 change: 1 addition & 0 deletions iPhone toss to Mac/old/inefficientwatcher.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# inefficientwatcher.py
import os
import time


Expand Down
1 change: 1 addition & 0 deletions iPhone toss to Mac/scriptrunner.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import subprocess
# _scriptrunner.py


Expand Down
3 changes: 2 additions & 1 deletion inner_monologue/inn_mono_gui.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QHBoxLayout, QLabel, QLineEdit, QPushButton, QTextEdit, QSpinBox, QDoubleSpinBox, QDialog
from inner_monologue import InnerMonologue

Expand Down Expand Up @@ -95,7 +96,7 @@ def get_response(self):
return self.text_edit.toPlainText()

def ask_user_question(self, question):
dialog = QuestionDialog(question)
dialog = self.QuestionDialog(question)
if dialog.exec_() == QDialog.Accepted:
return dialog.get_response()
return ""
Expand Down
1 change: 1 addition & 0 deletions llmchatroom/llmchatroom.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# llmchatroom.py
import requests
import json
from datetime import datetime
from queue import Queue
Expand Down
1 change: 1 addition & 0 deletions movelog/movelog.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# movelog.py
import os
import shutil

# Set the directory where you want to search for log files
Expand Down
1 change: 1 addition & 0 deletions mover/mover.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# mover.py
import shutil
from pathlib import Path

# Source directory to monitor
Expand Down
1 change: 1 addition & 0 deletions noder/noder.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Noder.py
import anthropic
import xml.etree.ElementTree as ET
from termcolor import colored
from pyfiglet import figlet_format
Expand Down
8 changes: 5 additions & 3 deletions nomic/nomic.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# nomic.py
import re
import anthropic
import time
import json
import random
Expand Down Expand Up @@ -215,8 +217,8 @@ def make_api_call(llm_id, game_state, history):
messages=[{"role": "user", "content": prompt}],
)

# Access the content directly from the Message object
response_content = response.content
# Extract the text from the Message object's content blocks
response_content = response.content[0].text

return response_content
def extract_proposed_rules(response):
Expand Down Expand Up @@ -271,7 +273,7 @@ def play_game():
response_content = make_api_call(llm_id, game_state, history)
history += response_content

game_state = update_game_state(game_state, response.content) # Use the response content
game_state = update_game_state(game_state, response_content) # Use the response content
Comment thread
CrazyDubya marked this conversation as resolved.
Resolved

for player in game_state["players"]:
if player["points"] >= 150:
Expand Down
1 change: 1 addition & 0 deletions shared_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def setup_logging(
)

logger = logging.getLogger(__name__.split('.')[0])
logger.setLevel(getattr(logging, level.upper()))

# Console handler
console_handler = logging.StreamHandler()
Expand Down
Loading