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 focusing on Gliński's variant, which is the most common.
The board is composed of three colors (so that the same color doesn't share an edge), with the edges of the hexagons facing the players. The board has 11 files, marked by letters a
through l
(letter j
is not used), and 11 ranks (which bend 60° at file f
). Ranks 1
through 6
each contain 11 cells, rank 7
has 9 cells, rank 8
has 7, and so on. Rank 11
contains exactly one cell: f11. (If it helps, think of each rank as making a very wide "V" shape.)
Here is an example picture of the board, with the knight on the center cell. The cells marked with a dot are the legal moves of this particular knight. The knight moves in a similar fashion to "normal" chess, two-down-and-one-over. In hexagonal chess terms, it's an orthogonal move (across an edge), then a diagonal move in the same direction (the closest move to the same color). For example with the knight below, an orthogonal move "up" to the light brown is then accompanied by a diagonal move "up and right" or "up and left" to the nearest light brown.
From the public domain via https://commons.wikimedia.org/wiki/File:Glinski_Chess_Knight.svg
This knight is positioned at f6 and the legal moves are thus
c4, c5, d3, d7, e3, e8, g3, g8, h3, h7, i4, i5
Input
A single input giving the starting cell of our knight. This can be as a single string "b6"
, as two strings, "b", "6"
, etc., in any convenient format. The input letters can be uppercase or lowercase -- your choice.
Output
A list of the valid moves that a knight on that location can make. This can be as an array of strings, a single string with an unambiguous and consistent delimiter, separate strings by newlines, etc., whatever is most convenient. The output does not necessarily need to be in sorted order, and can be in either uppercase or lowercase -- your choice.
Rules
- Assume no other pieces are on the board or interfere with the moves. We're focusing on just the knight.
- Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
- If possible, please include a link to an online testing environment so other people can try out your code!
- Standard loopholes are forbidden.
- This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.
Examples
b6
a3, c4, d5, d9, e7, e8
f6
c4, c5, d3, d7, e3, e8, g3, g8, h3, h7, i4, i5
f11
d8, e8, g8, h8
i1
f2, f3, g4, h4, l2, k3