Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Questions tagged [hexagonal-grid]

For challenges involving data on a hexagonal grid. Use this tag also for triangular grids, the dual of the hexagonal grid (that is, the vertices of the hexagonal grid form the faces of the triangular grid and vice versa).

Filter by
Sorted by
Tagged with
21 votes
4 answers
824 views

Is this hexagon symmetric?

TLDR: This is the hexagonal version of Is this square symmetrical? Given a hexagonal grid, decide if it is symmetric. The shape of the grid is a regular hexagon. Each cell in the grid has two possible ...
user avatar
  • 32.9k
8 votes
4 answers
376 views

AoCG2021 Leftover: HexaGoL

This challenge is one of the two challenges which were planned for Advent of Code Golf 2021, but didn't fit into the 25-day schedule. Related to AoC2020 Day 24, Part 2. Given a binary configuration ...
user avatar
  • 62.1k
12 votes
9 answers
574 views

AoCG2021 Day 17: Langton's Hexa-Virus

The story continues from AoC2017 Day 22, Part 2. The damn virus that was infecting a grid computing cluster now has jumped to a hexagonal computing cluster! In this cluster, the computers are ...
user avatar
  • 62.1k
12 votes
12 answers
1k views

AoCG2021 Day 6: Taxicab in a triangular city

Part of Advent of Code Golf 2021 event. See the linked meta post for details. Related to AoC2016 Day 1, Part 1. You're airdropped near Easter Bunny Headquarters in a city somewhere. "Near", ...
user avatar
  • 62.1k
29 votes
5 answers
2k views

Stack the rocks

This is a rock: * Rocks can be stacked. Apart from the bottom-most layer, each rock must rest on two other rocks, like this: ...
user avatar
  • 27.6k
13 votes
4 answers
574 views

Maximal hexagonal dot pattern

Challenge Imagine a hexagonal grid as shown below. Let's call such a grid has size \$n\$ if it has \$n\$ dots on one side. The following is one of size 3: ...
user avatar
  • 62.1k
8 votes
4 answers
322 views

Hexagonal section numbers

Introduction Let's draw some regular hexagons formed by hexagonal tiles, marking the vertices of the tiles with dots. Then we will count the number of dots. ...
user avatar
  • 62.1k
22 votes
3 answers
530 views

Sticky polyhexes

Background A polyhex of size \$n\$ is a contiguous shape made from joining \$n\$ unit regular hexagons side-by-side. As an example, the following image (from Wikipedia) contains all 7 distinct ...
user avatar
  • 62.1k
22 votes
2 answers
883 views

Cut a triangle into equal-sized parts!

Similar in spirit to Number of distinct tilings of an n X n square with free n-polyominoes and Partition a square grid into parts of equal area, this challenge will have you count ways of partitioning ...
user avatar
  • 8,097
9 votes
3 answers
500 views

Number of tilings on a triangular board with triangular tiles

Background Consider the shape \$T(n)\$ consisting of a triangular array of \$\frac{n(n+1)}{2}\$ unit regular hexagons: John Conway proved that \$n = 12k + 0,2,9,11\$ if and only if \$T(n)\$ can be ...
user avatar
  • 62.1k
10 votes
10 answers
315 views

Counting shortest paths on a triangular grid

Background An Eisenstein integer is a complex number of the form \$ z = a + b\omega \$ where \$a, b\$ are integers and \$\omega\$ is the third root of unity \$\frac{1-\sqrt3i}{2}\$. The Eisenstein ...
user avatar
  • 62.1k
20 votes
5 answers
512 views

What can you see on a hexagonal spiral?

This code-golf challenge will have you computing OEIS sequence A300154. Consider a spiral on an infinite hexagonal grid. a(n) is the number of cells in the part of the spiral from 1st to n-th cell ...
user avatar
  • 8,097
19 votes
2 answers
666 views

Counting creatures on a hexagonal tiling

This challenge will have you count "creatures" in the tile game Palago. A creature is any closed shape that can be formed by Palago tiles of matching colour in a hexagonal grid. The game Palago ...
user avatar
  • 8,097
31 votes
2 answers
1k views

A spiral sequence

Background OEIS sequence A272573 describes a spiral on a hexagonal grid as follows: Start a spiral of numbers on a hexagonal tiling, with the initial hexagon as a(1) = 1. a(n) is the smallest ...
user avatar
  • 8,097
36 votes
15 answers
3k views

Triangular Lattice Points close to the Origin

Background A triangular grid is a grid formed by tiling the plane regularly with equilateral triangles of side length 1. The picture below is an example of a triangular grid. A triangular lattice ...
user avatar
  • 62.1k
34 votes
2 answers
2k views

Halting Problem for Simplified Hexagony

Introduction Decide whether a Hexagony program composed solely of the characters .)_|\/><@ will halt using least bytes. Challenge Hexagony is a language ...
user avatar
  • 3,566
15 votes
6 answers
1k views

ASCII Hexagon Chain

Problem Draw a hexagon chain x long, each with side of y length Input x - the length of ...
user avatar
  • 3,847
28 votes
6 answers
1k views

Hexagonal adjacency

The above image displays a hexagonal grid of hexagons. Each cell in the grid is assigned an index, starting from the center and spiraling counterclockwise around as shown. Note that the grid will ...
user avatar
14 votes
26 answers
6k views

ASCII Rubik's Cube

Inspired by this and the following chat: Your task is to output the following: _ _ _ /_/_/_/\ /_/_/_/\/\ /_/_/_/\/\/\ \_\_\_\/\/\/ \_\_\_\/\/ \_\_\_\/ ...
user avatar
  • 13.5k
18 votes
10 answers
1k views

THE Magic Hexagon

There are many magic squares, but there is just one non-trivial magic hexagon, as Dr. James Grime explained, which is the following: ...
user avatar
  • 43k
21 votes
7 answers
1k views

Hexagonal Triangles!

Your task: make a hexagonal triangle with side length n, where n is a positive whole number or 0. First, let me define a ...
user avatar
  • 6,462
17 votes
6 answers
721 views

Working on my Knight moves

Hexagonal chess describes a family of chess variants played on a board where the cells are hexagons instead of the traditional squares. There are many such variants; in this challenge we'll be ...
user avatar
  • 42.8k
18 votes
4 answers
758 views

Embedded Hexagons!

Your task: given an integer n, generate an embedded hexagon pattern following the below rules, to the nth depth. An embedded hexagon has the basic shape of this: (...
user avatar
  • 6,462
27 votes
11 answers
2k views

Triangular Manhattan Distance

The Manhattan distance on a regular grid is the number of orthogonal steps one needs to take to reach one cell from another. Orthogonal steps are those that go through the edges of the grid cells (as ...
user avatar
56 votes
62 answers
8k views

Could you make me a hexagon please?

Today, we're going to make an ASCII hexagon. You must write a program or function that takes a positive integer n, and outputs a hexagon grid of size n, made up of asterisks. For example, a hexagon of ...
user avatar
29 votes
10 answers
2k views

Snowman Bowling

(related/inspired by: Draw a bowling formation) A fun pastime in the winter months here is to perform snowman bowling, using a large ball (like a basketball) and tiny snowman figures. Let's recreate ...
user avatar
  • 42.8k
10 votes
4 answers
486 views

Make a ASCII Hexagon Ring Tiling

Using ASCII print a section of a hexagon ring tiling. Here's a small section: ...
user avatar
  • 1,025
12 votes
2 answers
458 views

Hexagonal coordinates: Polar to Cartesian

Wikipedia says about Polar Coordinates: In mathematics, the polar coordinate system is a two-dimensional coordinate system in which each point on a plane is determined by a distance from a reference ...
user avatar
13 votes
4 answers
436 views

Hexagolf: Validagons

Challenge Given an ASCII art shape, you must find out whether the shape is a regular hexagon or not. Hexagons A regular hexagon is defined using two rules: It has six sides Each side has equal ...
user avatar
  • 22.8k
15 votes
4 answers
428 views

HexaGolf: Rotatagons

See also: Wordagons Challenge Given a hexagon and a number n as input, output the same hexagon rotated n times. Hexagon The ...
user avatar
  • 22.8k
25 votes
9 answers
1k views

HexaGolf: Wordagons

See also: Rotatagons Challenge Given a string as input, output its wordagon. Wordagons A wordagon is a way of representing a string in a hexagon. Now, let's create a wordagon from the string ...
user avatar
  • 22.8k
21 votes
9 answers
2k views

Hexplosive ASCII-art challenge

In the strategy game "Hexplode", players take turns placing tokens on a hexagonal board. Once the number of tokens equals the number of adjacent tiles, that tile hexplodes, and moves all of the tokes ...
user avatar
26 votes
8 answers
966 views

Highlight the Bounding Box, Part II: Hexagonal Grid

You're given a hexagonal grid of the characters . and #, like this: ...
user avatar
17 votes
7 answers
841 views

Gauss to Eisenstein

Given a Gaussian integer \$a+bi\$ where \$a\$,\$b\$ are integers and \$i = \exp\left(\pi i/2\right)\$ is the imaginary unit, return the closest (w.r.t to the Euclidean distance) Eisenstein integer \$k+...
user avatar
  • 43k
37 votes
3 answers
1k views

HexaRegex: A Tribute to Martin Ender

Martin Ender recently hit 100K, and has come up with some pretty awesome languages. We're going to have a bit of fun with one of them, Hexagony (and a bit of regex for Retina) As a brief overview, ...
user avatar
8 votes
3 answers
539 views

Counting Eisenstein primes

Introduction Eisenstein integers are complex numbers of the form a+bω Where a,b are integers, and ...
user avatar
  • 873
15 votes
1 answer
2k views

Draw and label an ASCII hexagonal grid

In my previous challenge, I drew the first diagram mostly by hand (with the help of vim's visual block mode). But surely there must be a better way... Given an input of two dimensions, a width and a ...
user avatar
  • 70.5k
15 votes
6 answers
841 views

Motion on a hexagonal grid

Given an input of a series of characters representing movements on a hexagonal grid, output the final coordinates of the "pointer." Our hexagons will be numbered like so (imagine a rectangular grid ...
user avatar
  • 70.5k
21 votes
6 answers
2k views

Triangular Ulam spiral

We've had a couple of challenges about the Ulam spiral. But that's not enough. In this challenge we will plot a triangular Ulam spiral (as opposed to the usual, square Ulam spiral). Here's a sketch ...
user avatar
  • 99.4k
9 votes
2 answers
742 views

Triangular Grids: Simply Connected Polyiamonds

While we're on a triangular grids kick, I'd like to point out that there is an equivalent to polyominoes on a triangular grid. They are called polyiamonds, and they are shapes formed by gluing ...
user avatar
  • 4,067
22 votes
3 answers
430 views

Alignment on Triangular Grids

Hexagonal grids have been become a fairly popular twist for challenges about 2-dimensional data recently. However, it seems that the equally interesting triangular grids have been largely neglected so ...
user avatar
53 votes
10 answers
4k views

Unfolding the Hexagony source code

Introduction If you're not familiar with Hexagony, it's an esoteric language created by Martin Büttner. The thing is that this language accepts multiple forms for the program. The following programs ...
user avatar
  • 43.4k
28 votes
6 answers
2k views

Hexagonal maze time!

Time for another maze challenge, but not as you know it. The rules for this challenge are a little different than most maze challenges. The tile types are defined as follows: ...
user avatar
  • 5,030
20 votes
1 answer
830 views

Packing Circles

Take a look at this image. Specifically, at how the holes on the ends are arranged. (Image source) Notice how the pipes in this image are packed in a hexagonal pattern. It is known that in 2D, a ...
user avatar
34 votes
1 answer
735 views

Program the Cup-Stacking Robot

I'm sure everyone has seen before that cups can be stacked into pyramids (and other shapes): A A A A A A A A A A A A A A A A A ...
user avatar
24 votes
6 answers
4k views

ASCII connected hexagons

Overview Given a number of hexagons, arrange them into a connected shape within the confines of a 50 by 50 ASCII art image. The shape you choose can be arbitrary - whatever you find most amenable to ...
user avatar
  • 10.7k
21 votes
2 answers
565 views

Rotate a diamond tiling

Any regular hexagon can be tiled with diamonds, for instance like so (stolen from this question): ...
user avatar
  • 35.8k
10 votes
1 answer
876 views

Play a Perfect Game of 4x4 Hex

Background Hex is a two-player abstract strategy game played on a K×K rhombus of hexagonal tiles. Two opposite sides of the rhombus are colored white, and ...
user avatar
  • 42k
19 votes
2 answers
8k views

Rotate a Chinese checkerboard

A Chinese checkerboard looks like this (based on this question, but this time it has a fixed size): ...
user avatar
  • 35.8k
8 votes
2 answers
4k views

Coding hex board game

Introduction Hex is a strategy board game played on a hexagonal grid, theoretically of any size and several possible shapes, but traditionally as an 11×11 rhombus. Other popular dimensions are 13×13 ...
user avatar
  • 1,474