A new package that processes user descriptions of fractal TicTacToe game states or strategies and returns structured analysis, such as identifying optimal moves, detecting winning patterns, or suggest
Project description
fractal-tictactoe-analyzer
A lightweight Python package that parses natural‑language descriptions of fractal Tic‑Tac‑Toe game states or strategies and returns a structured analysis. It can identify optimal moves, detect winning patterns, suggest game variations, and more—using a pattern‑matched response format that is easy to consume by downstream tools or AI agents.
Installation
pip install fractal_tictactoe_analyzer
Quick Start
from fractal_tictactoe_analyzer import fractal_tictactoe_analyzer
# Minimal usage – the function will create a default ChatLLM7 instance
response = fractal_tictactoe_analyzer(
user_input="I have a 3‑level fractal board, the top‑left corner is X, the centre is O..."
)
print(response) # -> List of extracted analysis strings
Advanced usage – providing your own LLM
You can pass any LangChain‑compatible chat model. The default is ChatLLM7 from the langchain_llm7 package.
OpenAI
from langchain_openai import ChatOpenAI
from fractal_tictactoe_analyzer import fractal_tictactoe_analyzer
my_llm = ChatOpenAI(model="gpt-4o")
response = fractal_tictactoe_analyzer(
user_input="Explain the best move on this fractal board...",
llm=my_llm
)
Anthropic
from langchain_anthropic import ChatAnthropic
from fractal_tictactoe_analyzer import fractal_tictactoe_analyzer
my_llm = ChatAnthropic(model="claude-3-5-sonnet")
response = fractal_tictactoe_analyzer(
user_input="Find a winning pattern in the nested 2×2 grid.",
llm=my_llm
)
Google Gemini
from langchain_google_genai import ChatGoogleGenerativeAI
from fractal_tictactoe_analyzer import fractal_tictactoe_analyzer
my_llm = ChatGoogleGenerativeAI(model="gemini-1.5-flash")
response = fractal_tictactoe_analyzer(
user_input="Generate a new variation of fractal Tic‑Tac‑Toe.",
llm=my_llm
)
Parameters
| Name | Type | Description |
|---|---|---|
user_input |
str |
The natural‑language description of the game state, strategy, or query. |
llm |
Optional[BaseChatModel] |
A LangChain chat model instance. If omitted, the function creates a ChatLLM7 using the API key from the environment (LLM7_API_KEY). |
api_key |
Optional[str] |
API key for ChatLLM7. If not supplied, the function reads LLM7_API_KEY from the environment. If that variable is also missing, a placeholder "None" is used (the underlying client will raise an authentication error). |
How It Works
- Prompt Construction – The package builds a system prompt and a human prompt (defined in
prompts.py) that guide the LLM to produce output matching a strict regular‑expression pattern. - Pattern Matching – The response from the LLM is validated against
pattern(also defined inprompts.py). Only data that conforms to the pattern is returned. - Extraction – The
llmatchhelper extracts the structured pieces of information, returning them as a list of strings.
Rate Limits & API Keys
- The free tier of LLM7 provides generous rate limits that are sufficient for typical development and small‑scale usage.
- For higher throughput, obtain a personal API key from LLM7:
- Register at: https://token.llm7.io/
- Export it in your environment:
export LLM7_API_KEY="your_key_here" - Or pass it directly to the function:
api_key="your_key_here".
Support & Contributions
- GitHub Issues: https://github.com/chigwell/fractal-tictactoe-analyzer/issues
- Feel free to open an issue for bugs, feature requests, or general questions.
License
This project is licensed under the MIT License.
Author
Eugene Evstafev
Email: hi@euegne.plus
GitHub: https://github.com/chigwell
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fractal_tictactoe_analyzer-2025.12.21131323.tar.gz.
File metadata
- Download URL: fractal_tictactoe_analyzer-2025.12.21131323.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d0effc8f4513e94ebf099f37366bc4341eaacca73f92838be2173f918bec7db
|
|
| MD5 |
77219d009163c830fc1c52d6d2407687
|
|
| BLAKE2b-256 |
9e2c6e2967fe22d7f283313275ce379626e2b04329534316e0ec8ba7a9794e3f
|
File details
Details for the file fractal_tictactoe_analyzer-2025.12.21131323-py3-none-any.whl.
File metadata
- Download URL: fractal_tictactoe_analyzer-2025.12.21131323-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
511ce8b6e479c21060ff3348c14e28d84487370cbacfb3a6a2ddf47029d5c6aa
|
|
| MD5 |
89d43665a387ebd508fa99a41d573aed
|
|
| BLAKE2b-256 |
851c81934c02c72add3bfbc519351b578c57d124ede297ab39b25d9f308894f6
|