#NEWLINE# def get_groups_around( self , position ) : #NEWLINE# #INDENT# "returns a list of the unique groups adjacent to position\n\n\t\t'unique' means that, for example in this position:\n\n\t\t\t. . . . .\n\t\t\t. B W . .\n\t\t\t. W W . .\n\t\t\t. . . . .\n\t\t\t. . . . .\n\n\t\tonly the one white group would be returned on get_groups_around((1,1))\n\t\t" #NEWLINE# groups = [ ] #NEWLINE# for ( nx , ny ) in self . _neighbors ( position ) : #NEWLINE# #INDENT# if ( self . board [ nx ] [ ny ] != EMPTY ) : #NEWLINE# #INDENT# group = self . group_sets [ nx ] [ ny ] #NEWLINE# group_member = next ( iter ( group ) ) #NEWLINE# if ( not any ( ( ( group_member in g ) for g in groups ) ) ) : #NEWLINE# #INDENT# groups . append ( group ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return groups