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
Metadata
Release files for fractal-tictactoe-analyzer 2025.12.21131323
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fractal_tictactoe_analyzer-2025.12.21131323.tar.gz | 5.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fractal_tictactoe_analyzer-2025.12.21131323-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.8 kB
Release files / fractal_tictactoe_analyzer-2025.12.21131323.tar.gz
| Download URL | fractal_tictactoe_analyzer-2025.12.21131323.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5d0effc8f4513e94ebf099f37366bc4341eaacca73f92838be2173f918bec7db
|
|
BLAKE2b-256 checksum How to use checksums |
9e2c6e2967fe22d7f283313275ce379626e2b04329534316e0ec8ba7a9794e3f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.1
|
Release files / fractal_tictactoe_analyzer-2025.12.21131323-py3-none-any.whl
| Download URL | fractal_tictactoe_analyzer-2025.12.21131323-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
511ce8b6e479c21060ff3348c14e28d84487370cbacfb3a6a2ddf47029d5c6aa
|
|
BLAKE2b-256 checksum How to use checksums |
851c81934c02c72add3bfbc519351b578c57d124ede297ab39b25d9f308894f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.1
|