One way to compare two grids is by the positions of the made moves. Essentially we want to create a hash value to identify grids that have the same moves but could have different lines.
To demonstrate this effect I have put together a demonstration.
Use the left and right arrow keys to cycle between configurations.
Grids sharing points with different lines
Hashing
To achieve this we iterate over the taken moves on the grid. We form a collection of strings with their x and y values. The list is then sorted and joined together by a token.
@taken_moves.collect{|move| "#{move.x},#{move.y}"}.sort.join('|')
NOTE: To keep the string shorter I SHA1 encode the string.
This provides a very quick way to tell if this configuration of points has been seen after a dna modification.
Thanks for the very nice presentation of a grid!