Allow custom matching for connected components

Added an optional function argument to Board.getConnectedComponents.
This function takes two arguments and returns true if the arguments are
equal in the sense that they should be part of the same connected
component.