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
10 votes
5 answers
382 views

Consolidate a 6-axis 2-dimensional Vector

Typically, when we want to represent a magnitude and direction in 2D space, we use a 2-axis vector. These axes are typically called X and Y: This isn't always convenient, however. The game BattleTech ...
Pavel's user avatar
  • 9,351
21 votes
10 answers
3k views

Totally random Catan number distributions

I like to play (The Settlers of) Catan on Board Game Arena with totally random number tokens. These tokens determine the production rate of the terrain tiles beneath: There are 18 number tokens, two ...
Parcly Taxel's user avatar
  • 3,707
15 votes
7 answers
759 views

A better Hexagony template

We once made a Hexagony template without actually knowing it. But after a bit of experience with Hexagony, it becomes apparent that it is not enough; sometimes the source code is too short for the ...
Bubbler's user avatar
  • 73.2k
21 votes
4 answers
912 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 ...
alephalpha's user avatar
  • 45.6k
8 votes
4 answers
396 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 ...
Bubbler's user avatar
  • 73.2k
12 votes
9 answers
599 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 ...
Bubbler's user avatar
  • 73.2k
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", ...
Bubbler's user avatar
  • 73.2k
30 votes
6 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: ...
emanresu A's user avatar
  • 34.5k
13 votes
4 answers
618 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: ...
Bubbler's user avatar
  • 73.2k
8 votes
4 answers
333 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. ...
Bubbler's user avatar
  • 73.2k
22 votes
3 answers
585 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 ...
Bubbler's user avatar
  • 73.2k
22 votes
2 answers
959 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 ...
Peter Kagey's user avatar
  • 8,649
9 votes
3 answers
532 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 ...
Bubbler's user avatar
  • 73.2k
10 votes
10 answers
331 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 ...
Bubbler's user avatar
  • 73.2k
20 votes
5 answers
531 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 ...
Peter Kagey's user avatar
  • 8,649
19 votes
2 answers
708 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 ...
Peter Kagey's user avatar
  • 8,649
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 ...
Peter Kagey's user avatar
  • 8,649
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 ...
Bubbler's user avatar
  • 73.2k
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 ...
Weijun Zhou's user avatar
  • 3,627
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 ...
LiefdeWen's user avatar
  • 3,867
29 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 ...
John Michael Law's user avatar
14 votes
26 answers
7k views

ASCII Rubik's Cube

Inspired by this and the following chat: Your task is to output the following: _ _ _ /_/_/_/\ /_/_/_/\/\ /_/_/_/\/\/\ \_\_\_\/\/\/ \_\_\_\/\/ \_\_\_\/ ...
Stephen's user avatar
  • 13.7k
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: ...
flawr's user avatar
  • 43.6k
21 votes
7 answers
2k 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 ...
sporkl's user avatar
  • 6,804
17 votes
6 answers
741 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 ...
AdmBorkBork's user avatar
  • 43.3k
19 votes
4 answers
785 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: (...
sporkl's user avatar
  • 6,804
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 ...
Martin Ender's user avatar
56 votes
63 answers
9k 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 ...
DJMcMayhem's user avatar
  • 58.8k
29 votes
10 answers
3k 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 ...
AdmBorkBork's user avatar
  • 43.3k
10 votes
4 answers
527 views

Make a ASCII Hexagon Ring Tiling

Using ASCII print a section of a hexagon ring tiling. Here's a small section: ...
Bobas_Pett's user avatar
  • 1,025
12 votes
2 answers
494 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 ...
DJMcMayhem's user avatar
  • 58.8k
13 votes
4 answers
464 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 ...
Beta Decay's user avatar
  • 23.2k
15 votes
4 answers
443 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 ...
Beta Decay's user avatar
  • 23.2k
25 votes
9 answers
2k 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 ...
Beta Decay's user avatar
  • 23.2k
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 ...
DJMcMayhem's user avatar
  • 58.8k
25 votes
8 answers
1k views

Highlight the Bounding Box, Part II: Hexagonal Grid

You're given a hexagonal grid of the characters . and #, like this: ...
Martin Ender's user avatar
17 votes
7 answers
867 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+...
flawr's user avatar
  • 43.6k
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, ...
Nathan Merrill's user avatar
8 votes
3 answers
582 views

Counting Eisenstein primes

Introduction Eisenstein integers are complex numbers of the form a+bω Where a,b are integers, and ...
Meow Mix's user avatar
  • 913
15 votes
1 answer
3k 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 ...
Doorknob's user avatar
  • 71.4k
15 votes
6 answers
898 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 ...
Doorknob's user avatar
  • 71.4k
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 ...
Luis Mendo's user avatar
  • 104k
9 votes
2 answers
818 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 ...
quintopia's user avatar
  • 4,087
22 votes
3 answers
462 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 ...
Martin Ender's user avatar
53 votes
11 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 ...
Adnan's user avatar
  • 44.2k
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: ...
J Atkin's user avatar
  • 5,070
20 votes
1 answer
867 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 ...
El'endia Starman's user avatar
34 votes
1 answer
768 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 ...
Martin Ender's user avatar
24 votes
6 answers
5k 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 ...
trichoplax is on Codidact now's user avatar
21 votes
2 answers
582 views

Rotate a diamond tiling

Any regular hexagon can be tiled with diamonds, for instance like so (stolen from this question): ...
jimmy23013's user avatar
  • 36.7k