DEV Community

Cover image for ⬢ Hexagony — The Language That Runs on a Hexagonal Grid Instead of Lines
Pʀᴀɴᴀᴠ
Pʀᴀɴᴀᴠ

Posted on

⬢ Hexagony — The Language That Runs on a Hexagonal Grid Instead of Lines

What is Hexagony?

Hexagony is an esoteric programming language created by Martin Ender. It is similar to 2D languages like Befunge and Fish, but instead of using a square grid, Hexagony executes code on a hexagonal grid. The instruction pointer can move in six possible directions (like navigating a honeycomb), making logic flow far less predictable than traditional line-based languages.

The name comes from "hexagon" and "agony" — because writing and debugging Hexagony programs can be mentally painful, especially when control flow spirals or loops unexpectedly across the grid.


Specs

Language Type: Esoteric / Hexagonal geometry

Released: 2015

Creator: Martin Ender

Execution Model: Stack machine with six-direction movement

Syntax: Symbol-based operations

Purpose: Push 2D execution models further into chaos


CODE EXAMPLE (Hello World)

A compact Hexagony “Hello World” program may look like:

".Hello, World!"&>:@
Enter fullscreen mode Exit fullscreen mode

Depending on interpreter and grid wrapping rules, that outputs:

Hello, World!

(Some official programs use carefully arranged hex layouts that cannot be fully represented in plain text.)


How It Works

  • The program is written inside a connected hex grid.
  • The instruction pointer moves based on characters it encounters.
  • Directions correspond to:
    • Up-left
    • Up-right
    • Left
    • Right
    • Down-left
    • Down-right
  • The language includes stack manipulation, arithmetic, branching, and I/O.
  • Like Befunge, strings push characters automatically, and special operators modify flow.

Because the storage model mirrors the shape of the code, execution becomes spatial rather than linear.


Strengths

  • Extremely creative visual layout.
  • Fully Turing-complete despite simple syntax.
  • Excellent for puzzles, challenges, and visual logic design.
  • A unique alternative to traditional grid-based esolangs.

Weaknesses

  • Hard to write without dedicated editors that enforce hex structure.
  • Debugging can feel impossible when execution loops diagonally.
  • Syntax representation in plain text is awkward.
  • Limited interpreter support outside esolang communities.

Where to Run

Hexagony can be executed on:

  • TIO.run
  • Online hex editing playgrounds
  • GitHub interpreter implementations
  • Hex-visual debugging tools made by the community

Some versions show real-time pointer movement through the grid.


Should You Learn It?

For serious engineering: No

For esolang exploration and puzzle solving: Yes

For learning 2D/geometry-based execution models: Absolutely

For readable or maintainable code: Never


Summary

Hexagony takes the concept of 2D esolangs and pushes it further by using a hexagonal grid instead of a square one. Programs become intricate geometric structures, and execution behaves like navigating a honeycomb maze. While chaotic and impractical, Hexagony is one of the most clever and visually fascinating languages in the esolang universe.

Top comments (0)