Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 67860

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).

1 vote

Hexagonal adjacency

Python 3, 150 bytes def h(a,b): L=[];i=1 while len(L)<a+b:r=sum((i*[1j**(k/3)]for k in range(4,16,2)),[]);r[0]+=1;L+=r;i+=1 return.9<abs(sum(L[min(a,b):max(a,b)]))<1.1 My solution basically foll …
Hermen's user avatar
  • 31