Skip to content

yogevat/python-games-library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hey, That's My Fish!

A Python implementation of the board game Hey, That's My Fish! with both a CLI and a Pygame GUI.

Players take turns placing penguins on an ice-floe hex grid, then moving them in straight lines to collect fish. Tiles sink behind you, cutting off opponents. The player with the most fish wins.

GUI Screenshot

Features

  • Full game engine with setup, playing, and scoring phases
  • Hex grid with axial coordinate math
  • Configurable board size, player count, and fish distribution via YAML
  • Interactive CLI (penguins)
  • Pygame GUI with ice-themed visuals, animated highlights, and cute penguin sprites (penguins-gui)
  • Scriptable Python API for bots and automation

Installation

# Clone the repo
git clone https://github.com/yogevattias/python-games-library.git
cd python-games-library

# Install (requires Python 3.10+)
pip install -e .

# For development / running tests
pip install -e ".[dev]"

Quick Start

GUI (Pygame)

penguins-gui
# or
python -m penguins.gui.app
  • Click tiles to place penguins during setup
  • Click a penguin, then click a green-highlighted tile to move
  • Press R to restart, Q to quit

CLI

penguins

Follow the on-screen prompts to place and move penguins using row,col coordinates.

Python API

Use the engine directly in scripts to build bots or run simulations:

from penguins.core.engine import GameEngine
from penguins.core.types import HexCoord

engine = GameEngine()

# Setup phase — place penguins on 1-fish tiles
for coord in engine.board.all_coords():
    if engine.board.get_tile(coord) == 1 and not engine.board.has_penguin(coord):
        engine.place_penguin(engine.current_player.player_id, coord)
        if engine.phase.value == "playing":
            break

# Playing phase — query moves and play
moves = engine.get_valid_moves(engine.current_player.player_id)
for penguin, destinations in moves.items():
    fish = engine.move_penguin(engine.current_player.player_id, penguin, destinations[0])
    print(f"Collected {fish} fish")
    break

print(engine.get_scores())

Configuration

Edit config/default.yaml to change game settings:

board:
  rows: 8
  cols: 8

players:
  count: 2
  penguins_per_player: 4

fish_distribution:
  one_fish: 30
  two_fish: 20
  three_fish: 10

Or load custom settings in code:

from penguins.core.types import GameSettings

settings = GameSettings.from_yaml("my_config.yaml")
engine = GameEngine(settings=settings)

Running Tests

pytest tests/ -v

Project Structure

src/penguins/
  core/
    types.py      # HexCoord, GamePhase, GameSettings
    board.py      # Hex grid, tiles, penguin tracking, reachability
    engine.py     # Game orchestration (place, move, scoring, turns)
    player.py     # Player state and score
  utils/
    hex_math.py   # Axial coordinate math, neighbors, line tracing
  cli/
    runner.py     # Terminal-based interactive game
  gui/
    app.py        # Pygame GUI with ice-themed visuals
config/
  default.yaml    # Default game configuration
tests/            # Pytest test suite

License

MIT

About

Hey, That's My Fish\! - A Python board game library with CLI and Pygame GUI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages