PyCatan-AI / examples /README.md
EZTIME2025
organise the project
69373e6
|
raw
history blame
1.78 kB

PyCatan Examples

This directory contains example code, demos, and utility scripts for the PyCatan project.

Directory Structure

๐ŸŽฎ demos/

Game Demonstrations - Complete playable examples showing how to use PyCatan.

  • play_catan.py - Main interactive game with CLI and web visualization
  • demo_point_system.py - Demonstration of the point numbering system

Run a demo:

python examples/demos/play_catan.py

๐Ÿ› ๏ธ scripts/

Utility Scripts - Helper tools for development and debugging.

  • check_steal_tiles.py - Verify robber tile stealing mechanics
  • print_game_logic.py - Print game state and logic for debugging

Run a script:

python examples/scripts/check_steal_tiles.py

๐Ÿ“Š board_renderer.py

Visual board rendering utility (legacy file in root of examples/).

Usage

Running the Interactive Game

The main demo provides a full interactive Catan game experience:

cd examples/demos
python play_catan.py

This will:

  • Start a game with configurable number of players
  • Provide CLI interface for actions
  • Launch web visualization in browser
  • Support all game mechanics (building, trading, development cards)

Understanding the Point System

To understand how board points are numbered:

python examples/demos/demo_point_system.py

Creating Your Own Game

Use these examples as templates for your own games:

from pycatan import Game, GameManager, HumanUser
from pycatan import ConsoleVisualization, WebVisualization

# Create users
users = [HumanUser("Alice"), HumanUser("Bob")]

# Create visualizations
visualizations = [
    ConsoleVisualization(),
    WebVisualization()
]

# Start game
manager = GameManager(users, visualizations)
manager.start_game()