From: Sander Land Date: 2009-02-03T04:06:27+09:00 Subject: Re: [QUIZ] Hexagonal Grid Game Board (#190) Here is my solution. Pastie: http://pastie.org/377536 The pastie still has the comment on the distances function as returning the distance between two hexes, but I changed this to return an array of all distances from some position, since the breadth-first search was already calculating this anyway. class Hex attr_accessor :neighbours,:distance def initialize(row,col,rows,cols) @neighbours = [[-1,-1],[-1,0],[0,-1],[0,1],[1,0],[1,1]].map{|r,c|[row+r,col+c]}.select{|r,c| r>=0 && c>=0 && r