Problems using KeySelect for associations

I'm quite new at mathematica so hopefully this is fairly simple. I am trying to make a snowflake using a hexagonal grid. I have a list of co-ordinates pnts that represent the centre of unit hexagons and then I am using an association values to give a value to each hexagon i.e (0,0)->1 where >=1 represents an ice cell. I have made a function to select the ice cells using Select fine Ice[x_] := Select[x, # >= 1 &]but the thing I am having trouble with is using KeySelect to find the hexagons adjacent to ice cells. The way I am trying to do this is that the distance between two adjacent hexagons is Srqt so I have:

Boundary[x_] := KeySelect[x, EuclideanDistance[#, Keys[Ice[x]]] == Sqrt &]

But this is returning an empty association. This looked like a nice way of doing it but really I am looking for a fast way to do it as I have have to do this an awful lot over the course of the program

n = 3;
somepnts = Flatten[Table[{3.*x, Sqrt*y}, {x, -n + Ceiling[n/4], n - Ceiling[n/4], 1}, {y, -n, n, 1}], 1];
otherpnts = Flatten[Table[{(6.*x + 3)/2, (2*y + 1)*Sqrt/2}, {x, -n + Ceiling[n/4], (n - 1) - Ceiling[n/4], 1}, {y, -n, n - 1, 1}], 1];
pnts = Union[somepnts, otherpnts]

AdjacentHexagons[x_] := Table[If[EuclideanDistance[x, pnts[[i]]] == Sqrt,pnts[[i]], Nothing], {i, 1, Length[pnts]}]
values = <|Table[pnts[[i]] -> N[0.1], {i, 1, Length[pnts]}]|>;
Table[values[AdjacentHexagons[{0, 0.}][[i]]] = N[0.5], {i, 1, 6}];
values[{0., 0.}] = 1.;
values

This is the data set I am using

• @A Keith can you post a minimal dataset so that the others can play around with it. or perhaps share link to the data – Ali Hashmi Mar 20 '17 at 18:18
• n = 3; (*make a roughly 2nx2n grid of hexagon tiling based on simple \ geometry and trigonometry on unit hexagons*) somepnts = Flatten[Table[{3.*x, (Sqrt // N)*y}, {x, -n + Ceiling[n/4], n - Ceiling[n/4], 1}, {y, -n, n, 1}], 1]; otherpnts = Flatten[Table[{(6.*x + 3)/2, (2*y + 1)*(Sqrt // N)/2}, {x, -n + Ceiling[n/4], (n - 1) - Ceiling[n/4], 1}, {y, -n, n - 1, 1}], 1]; pnts = Union[somepnts, otherpnts] – A Keith Mar 20 '17 at 22:38