Skip to content

All projects

Hive — Python Strategy Board Game

A two-player strategy board game developed with Python and Pygame, featuring hexagonal grid navigation, piece-specific movement algorithms, rule validation, and graph-based connectivity checks.

Screenshot of Hive — Python Strategy Board Game

Problem

Hive is a strategy board game played on an expanding hexagonal grid without a fixed board. Each insect type follows different movement rules, and every move must preserve the connectivity of the entire hive.

Implementing the game digitally requires representing hexagonal coordinates, validating complex piece movements, enforcing turn-dependent rules, and detecting winning conditions while maintaining an interactive graphical interface.

The objective was to develop a playable two-player desktop version of Hive with rule-based movement validation and automated game-state management.

Approach

Designed a modular, object-oriented architecture using Python, with dedicated classes for game pieces, hexagonal tiles, player inventories, and game-state management.

Represented the game board using axial hexagonal coordinates and precomputed tile adjacency relationships to support movement calculations.

Implemented piece-specific movement algorithms, including single-step Queen movement, multi-step Ant movement, exactly three-step Spider movement, Beetle stacking, and straight-line Grasshopper jumping.

Applied breadth-first search to validate movement paths and check whether removing a piece would disconnect the hive. Added rule validation for legal piece placement, compulsory Queen placement, turn restrictions, and end-game detection.

Developed a Pygame graphical interface with mouse-based interactions, visual piece rendering, player inventories, turn indicators, and dedicated start, end-game, and no-available-move screens.

Outcome

Implemented a two-player desktop version of Hive featuring five insect types, a hexagonal board, mouse-controlled interactions, piece-specific movement validation, and automated game-state transitions.

Developed graph-based connectivity checks to enforce the One Hive Rule and pathfinding routines for validating multi-step piece movement.

Implemented win and draw detection based on whether one or both Queen Bees become surrounded, alongside turn skipping when a player has no available moves.

The project demonstrates object-oriented programming, graph traversal, geometric coordinate systems, state management, and interactive desktop application development.

Highlights

  • Developed a two-player strategy game using Python and Pygame
  • Implemented movement rules for five distinct insect types
  • Used axial coordinates to model a hexagonal game board
  • Applied breadth-first search for pathfinding and hive connectivity checks
  • Enforced movement restrictions and the One Hive Rule
  • Built an interactive GUI with turn management and player inventories
  • Implemented automated win and draw detection

Notes

Developed a desktop implementation of Hive, a two-player abstract strategy board game, as part of an Artificial Intelligence university course. The application recreates the game's hexagonal playing field, interactive piece movement, turn management, and rule-based gameplay using Python and Pygame.

Designed an object-oriented game architecture with separate modules for game state, board tiles, insect pieces, movement validation, player inventories, and user interface components.

Implemented movement rules for five distinct insect types: Queen Bee, Ant, Spider, Beetle, and Grasshopper. Each piece has unique movement behavior, requiring different validation and pathfinding logic.

Used axial coordinates to represent the hexagonal grid and breadth-first search to check board connectivity and validate movement paths. Implemented the One Hive Rule, which prevents players from making moves that disconnect the hive.

Built an interactive graphical interface featuring mouse-controlled movement, player inventories, turn indicators, start and end menus, automatic turn skipping when no moves are available, and win detection when a queen becomes completely surrounded.