Skip to content

k1-c/meiro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

23 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿงฉ Meiro

Terminal-based maze generation & solving game

CI Release License Platform

Demo

Navigate through algorithmically generated mazes with style ๐ŸŽฏ

โœจ Features

๐ŸŽฎ Interactive Gameplay โ€ข Navigate with WASD or arrow keys
๐Ÿง  Multiple Algorithms โ€ข Recursive Backtracking, Kruskal's MST, Prim's MST
๐ŸŽจ Beautiful Rendering โ€ข Unicode art with emoji characters
โšก Lightning Fast โ€ข Written in Haskell for optimal performance
๐Ÿ“ฆ Zero Dependencies โ€ข Single static binary, ready to run
๐ŸŒ Cross Platform โ€ข macOS (Intel & Apple Silicon) and Linux support


๐Ÿš€ Quick Start

One-line Install

curl -fsSL https://raw.githubusercontent.com/k1-c/meiro/main/install.sh | bash

Or with custom install directory:

curl -fsSL https://raw.githubusercontent.com/k1-c/meiro/main/install.sh | MEIRO_INSTALL_DIR=~/.local/bin bash

Command & Arguments

# Basic usage - start game with default settings
meiro

# Specify maze size (width x height) - both must be odd numbers >= 5
meiro --size 15x15
meiro -s 25x35

# Choose algorithm
meiro --algorithm recursive    # Recursive Backtracking (default)
meiro --algorithm kruskal      # Kruskal's MST
meiro --algorithm prim         # Prim's MST
meiro -a kruskal              # Short form

# Combine options
meiro --size 41x31 --algorithm prim

# Help & version
meiro --help                   # Show help message
meiro --version                # Show version info

Available Options:

Option Short Description Default
--size WxH -s Maze dimensions (width x height, both must be odd numbers โ‰ฅ 5) 25x15
--algorithm -a Generation algorithm (recursive, kruskal, prim) recursive
--help -h Show help message -
--version -v Show version information -

๐ŸŽฏ How to Play

โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ
โ–ˆโ–ˆ๐Ÿ     โ–ˆโ–ˆ  โ–ˆโ–ˆ              โ–ˆโ–ˆ
โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ  โ–ˆโ–ˆ  โ–ˆโ–ˆ  โ–ˆโ–ˆ  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ  โ–ˆโ–ˆ
โ–ˆโ–ˆ      โ–ˆโ–ˆ      โ–ˆโ–ˆ  โ–ˆโ–ˆ      โ–ˆโ–ˆ
โ–ˆโ–ˆ  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ  โ–ˆโ–ˆ  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ
โ–ˆโ–ˆ  โ–ˆโ–ˆ              โ–ˆโ–ˆ      โ–ˆโ–ˆ
โ–ˆโ–ˆ  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ  โ–ˆโ–ˆ
โ–ˆโ–ˆ          โ–ˆโ–ˆ          โ–ˆโ–ˆ  โ–ˆโ–ˆ
โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ  โ–ˆโ–ˆ  โ–ˆโ–ˆ  โ–ˆโ–ˆ
โ–ˆโ–ˆ          โ–ˆโ–ˆ      โ–ˆโ–ˆ  โ–ˆโ–ˆ  โ–ˆโ–ˆ
โ–ˆโ–ˆ  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ  โ–ˆโ–ˆ  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ  โ–ˆโ–ˆ
โ–ˆโ–ˆ  โ–ˆโ–ˆ          โ–ˆโ–ˆ          โ–ˆโ–ˆ
โ–ˆโ–ˆ  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ
โ–ˆโ–ˆ                        ๐Ÿค–โ–ˆโ–ˆ
โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ

Controls:

  • WASD or Arrow Keys โ€ข Move around
  • Q โ€ข Quit game

๐Ÿ”ฌ Algorithms

๐ŸŒฟ Recursive Backtracking (Default)
  • Type: Depth-First Search
  • Characteristics: Creates long winding passages with high "river" factor
  • Performance: O(n) time, O(n) space
  • Best for: Classic maze feel with challenging paths
๐ŸŒŠ Kruskal's Algorithm
  • Type: Minimum Spanning Tree
  • Characteristics: Creates more open areas with shorter dead ends
  • Performance: O(n log n) time, O(n) space
  • Best for: Balanced difficulty with multiple solution paths
๐ŸŽฏ Prim's Algorithm
  • Type: Minimum Spanning Tree (growing tree)
  • Characteristics: Creates dense branching with organic growth patterns
  • Performance: O(n log n) time, O(n) space
  • Best for: Compact mazes with natural-looking structures

๐Ÿ—๏ธ Architecture

Built with modern Haskell practices:

src/
โ”œโ”€โ”€ Meiro/
โ”‚   โ”œโ”€โ”€ Types.hs              # Core data types
โ”‚   โ”œโ”€โ”€ Utils.hs              # Utility functions
โ”‚   โ”œโ”€โ”€ Rendering.hs          # Terminal rendering
โ”‚   โ”œโ”€โ”€ Gameplay.hs           # Game logic & input
โ”‚   โ””โ”€โ”€ Algorithms/
โ”‚       โ”œโ”€โ”€ RecursiveBacktrack.hs
โ”‚       โ”œโ”€โ”€ Kruskal.hs        # Union-Find implementation
โ”‚       โ””โ”€โ”€ Prim.hs           # Set-based algorithm

Tech Stack:

  • Language: Haskell with GHC 9.10
  • Build System: Stack
  • Dependencies: Minimal (only base libraries)
  • Testing: Hspec + QuickCheck
  • CI/CD: GitHub Actions

๐Ÿ› ๏ธ Development

Prerequisites

Build from Source

git clone https://github.com/k1-c/meiro.git
cd meiro

# Development build
stack build

# Run tests
stack test

# Build optimized binary
stack build --copy-bins --local-bin-path ./dist

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.


๐Ÿ“Š Performance

Metric Value
Binary Size ~4MB
Memory Usage <10MB
Startup Time <100ms
50x50 Maze <1ms generation

๐ŸŽจ Customization

Meiro supports custom rendering styles through the CellStyle configuration:

customStyle = CellStyle
    { wallChar   = "โ–ˆโ–ˆ"
    , pathChar   = "  "
    , startChar  = "๐Ÿ "
    , goalChar   = "๐Ÿ"
    , playerChar = "๐Ÿค–"
    }

๐Ÿ“‹ System Requirements

Supported Platforms:

  • macOS 10.15+ (Intel & Apple Silicon)
  • Linux x86_64 (Ubuntu 18.04+, etc.)

Requirements:

  • Terminal with Unicode support
  • 4MB free disk space
  • 10MB RAM

๐Ÿ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.


Made with โค๏ธ in Haskell

Report Bug โ€ข Request Feature โ€ข Contribute

About

๐Ÿงฉ Terminal-based Maze Generation & Solving Game written in Haskell

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •