CLAUDE.md
CLAUDE.mdCLAUDE.mdroot
Quality
96/100
Scores the file, not the repository.Length
834 words
25 headings · 9 code blocksRepository
0
— · pushed 204 days agoLast changed
3 days ago
First indexed 3 days ago.1# CLAUDE.md23This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.45## Project Overview67This is a competitive AI bot development project for the Game of Amazons, designed to run on the Botzone platform. The project focuses on creating high-performance bots using Monte Carlo Tree Search (MCTS) with various optimization techniques.89**Key Technologies**: Python 3.6+, C++11, NumPy10**Platform**: Botzone (Ubuntu 16.04 x86-64)11**Game**: Amazons (8×8 board, 4 amazons per player, queen movement + arrow shooting)1213## Development Commands1415### Bot Compilation16C++ bots are compiled manually with:17```bash18g++ -O3 -std=c++11 -o bots/botXXX bots/botXXX.cpp19```2021The tournament system provides a helper function:22```bash23python -c "from scripts.tournament.utils import compile_bot; compile_bot('bot003')"24```2526### Testing Commands27**Quick functionality test** (first move as BLACK):28```bash29echo "130-1 -1 -1 -1 -1 -1" | python bots/bot001.py31# or for C++ bots:32echo "133-1 -1 -1 -1 -1 -1" | ./bots/bot001_cpp34```3536**Run simple bot tests**:37```bash38python scripts/test_bot_simple.py39```4041**Run Botzone protocol simulation**:42```bash43python scripts/botzone_simulator.py44```4546### Tournament System47The tournament framework (`scripts/tournament/`) provides comprehensive testing:4849**Single match**:50```bash51python -c "from scripts.tournament.cli import run_match; run_match('bot001', 'bot003')"52```5354**Competition automation** (10-game series):55```bash56python scripts/run_competitions.py57```5859**Check legal moves** (debugging tool):60```bash61python scripts/check_legal_moves.py62```6364**Debug board visualization**:65```bash66python scripts/debug_board.py67```6869## Architecture Overview7071### Directory Structure72- `core/` - Shared game logic (board representation, move generation)73- `bots/` - Bot implementations (Python and C++ versions)74- `scripts/` - Testing and utility scripts75- `docs/` - Comprehensive documentation76- `memorybank/` - Project context and technical decisions (Cline system)77- `results/` - Tournament results (JSON format)78- `logs/` - Match logs and output7980### Bot Architecture81The primary algorithm is **Multi-Component MCTS** with these key features:82831. **Multi-Component Evaluation**: Five strategic factors combined:84 - Queen Territory (BFS-based territory control)85 - King Territory (weighted close-range control)86 - Queen Position (exponential decay scoring)87 - King Position (distance-weighted positioning)88 - Mobility (available moves count)89902. **Phase-Aware Weighting**: Different strategies for early/mid/late game phases91923. **Dynamic UCB Constant**: Exploration decreases as game progresses93944. **Long-Running Mode**: Maintains MCTS tree state between turns for efficiency9596### Bot Implementations97- `bot001.py` / `bot001.cpp` - Primary MCTS implementation (Python and C++ versions)98- `bot002.cpp` - Optimized version with bitboard representation (has TLE issues)99- `bot003.cpp` - Baseline MCTS bot for comparison100- `bot004-bot008.cpp` - Optimization bots with different techniques101- `opponent.cpp` - Latest implementation with AVX2 SIMD optimizations102103## Platform Constraints (Botzone)104105### Time Limits106- **Python long-running bots**: 12s (first turn), 4s (subsequent turns)107- **C++ long-running bots**: 2s (first turn), 1s (subsequent turns)108109### Resource Limits110- Memory: 256 MB default111- CPU: Single core (no multi-threading benefit)112113### I/O Protocol114- Simplified interaction: Line-based stdin/stdout115- Long-running mode: Must flush stdout after each turn116- Move format: 6 integers `x0 y0 x1 y1 x2 y2`117118## Development Workflow119120### Cline Memory Bank System121The project uses a Cline memory bank (`memorybank/`) for context:122- `projectbrief.md` - Project overview and objectives123- `systemPatterns.md` - Architecture and design decisions124- `techContext.md` - Technologies and constraints125- `activeContext.md` - Current state and next steps126- `progress.md` - Development progress and milestones127128### Development Rules (`.clinerules/`)129- `development_workflow.md` - Development processes130- `task_completion.md` - Mandatory sequential workflow for task completion131- `memory_bank_update.md` - How to update memory bank files132- `readme_update.md` - README update procedures133134### Key Development Patterns1351. **Always test sequentially** - Run tests in order: simple test → protocol simulation → tournament1362. **Update memory bank first** - Review and update memory bank files before making changes1373. **Check Botzone compatibility** - Ensure bots work within platform constraints1384. **Use tournament framework** - For comprehensive testing and performance comparison139140## Common Tasks141142### Creating a New Bot1431. Copy an existing bot (e.g., `bot003.cpp`) as a starting point1442. Implement optimization technique1453. Compile: `g++ -O3 -std=c++11 -o bots/botXXX bots/botXXX.cpp`1464. Test with simple test script1475. Run competition against baseline (`bot003`)1486. Analyze results in `results/competitions/`149150### Debugging TLE (Time Limit Exceeded) Issues1511. Check time limits in bot code (conservative buffers required)1522. Use tournament system to measure actual execution times1533. Profile with `scripts/check_legal_moves.py` for move generation issues1544. Review Botzone logs for specific timing patterns155156### Testing Botzone Compatibility1571. Use `botzone_simulator.py` to simulate platform I/O1582. Verify long-running mode works correctly1593. Check memory usage stays under 256 MB1604. Ensure move format matches Botzone expectations161162## Important Notes163164- **No automated build system** - Bots are compiled manually165- **NumPy dependency** - Required for Python bots, not for C++ bots166- **Tree reuse** - MCTS trees are preserved between turns in long-running mode167- **Bitboard representation** - Used in optimized bots for faster operations168- **AVX2 optimizations** - Latest addition in `opponent.cpp` for SIMD parallelism169170## Getting Started1711. Read `README.md` for comprehensive project overview1722. Check `memorybank/` for current project context1733. Use tournament framework for testing: `scripts/tournament/`1744. Follow Cline workflows in `.clinerules/` for development tasks
Also in RizzoHou/amazing-amazons
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| RizzoHou/amazing-amazons.clinerules/cline_operations.md · 0 | Cline rules | no sections | 25/100 | 3 days ago | |
| RizzoHou/amazing-amazons.clinerules/development_workflow.md · 0 | Cline rules | styleagent-behaviour | 43/100 | 3 days ago | |
| RizzoHou/amazing-amazons.clinerules/documentation.md · 0 | Cline rules | docs | 25/100 | 3 days ago | |
| RizzoHou/amazing-amazons.clinerules/memorybank.md · 0 | Cline rules | archperformanceagent-behaviourdocs | 52/100 | 3 days ago | |
| RizzoHou/amazing-amazons.clinerules/project_setup.md · 0 | Cline rules | setupagent-behaviour | 25/100 | 3 days ago | |
| RizzoHou/amazing-amazons.clinerules/version_control.md · 0 | Cline rules | stylegitdeployment | 17/100 | 3 days ago |
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| ClickHouse/ClickHouse.claude/CLAUDE.md · 49k | CLAUDE.md | buildteststylearch+6 | 96/100 | 2 days ago | |
| electron/electronCLAUDE.md · 122k | CLAUDE.md | setupbuildteststyle+5 | 96/100 | 3 days ago | |
| pytorch/pytorchCLAUDE.md · 102k | CLAUDE.md | setupbuildtestlint-format+5 | 88/100 | 3 days ago | |
| pytorch/pytorchtorch/_dynamo/CLAUDE.md · 102k | CLAUDE.md | buildteststylearch | 84/100 | 3 days ago | |
| facebook/rocksdbCLAUDE.md · 32k | CLAUDE.md | buildtestlint-formatstyle+8 | 64/100 | 3 days ago | |
| ossrs/srs.claude/CLAUDE.md · 29k | CLAUDE.md | monorepoagent-behaviour | 16/100 | yesterday |
