parameters: (strings, attempts, display=False, stdOutput=False)
return_statement: return len(meshes)
docstring: This function is temporary.  I will soon merge it with splittingMesher to allow for arbitrary levels of splitting
      in the same function.
docstring_summary: This function is temporary.  I will soon merge it with splittingMesher to allow for arbitrary levels of splitting
      in the same function.
docstring_tokens: This function is temporary . I will soon merge it with splittingMesher to allow for arbitrary levels of splitting in the same function .
function: def doubleSplittingMesher(strings, attempts, display=False, stdOutput=False):
      """This function is temporary.  I will soon merge it with splittingMesher to allow for arbitrary levels of splitting
      in the same function."""
      if display:
          print "using double Splitting Mesher"
      buckets = [[], []], [[], []]
      length = len(strings[0])
      numStrings = len(strings)
      splittingString1 = ("1" * (length / 2)) + ("0" * (length / 2))
      splittingString2 = ("10" * (length / 2))
      for string in strings:
          s = long(string, base=2)
          diff = hamming(string, splittingString1)
          diff2 = hamming(string, splittingString2)
  
          if diff < int(length * 0.5):
              id1 = 0
          elif diff == int(length * 0.5):
              if random.randint(0, 1):
                  id1 = 0
              else:
                  id1 = 1
          else:
              id1 = 1
  
          if diff2 < int(length * 0.5):
              id2 = 0
          elif diff == int(length * 0.5):
              if random.randint(0, 1):
                  id2 = 0
              else:
                  id2 = 1
          else:
              id2 = 1
  
          buckets[id1][id2].append(s)
      formatstring = "{0:0" + str(length) + "b}"
      for layer in buckets:
          for thing in layer:
              print len(thing)
  #    print buckets
  
      meshes = []
  
      check1 = True
      check2 = True
      for k in range(attempts):
          dim1 = min(len(buckets[0][0]), len(buckets[1][1]))
          dim2 = min(len(buckets[0][1]), len(buckets[1][0]))
  #        print dim1, dim2
          if dim1 == 0:
              if check1:
                  print 'found meshes for everything in set 1, so stopped after {} attempts'.format(k)
                  check1 = False
          else:
              matched1 = []
              if dim1 == 1:
                  num1 = buckets[0][0][0]
                  num2 = buckets[1][1][0]
                  if num1 & num2 == 0:
                      matched1.append(0)
              for i in range(dim1 - 1, 0, -1):
                  num1 = buckets[0][0][i]
                  num2 = buckets[1][1][i]
                  if num1 & num2 == 0:
                      matched1.append(i)
              for x in matched1:
                  meshes.append((buckets[0][0][x], buckets[1][1][x]))
              for x in matched1:
                  del buckets[0][0][x]
                  del buckets[1][1][x]
          if dim2 == 0:
              if check2:
                  print 'found meshes for everything in set 2, so stopped after {} attempts'.format(k)
                  check2 = False
          else:
              matched2 = []
              if dim2 == 1:
                  num1 = buckets[0][1][0]
                  num2 = buckets[1][0][0]
                  if num1 & num2 == 0:
                      matched2.append(0)
              for i in range(dim2 - 1, 0, -1):
                  num1 = buckets[0][1][i]
                  num2 = buckets[1][0][i]
                  if num1 & num2 == 0:
                      matched2.append(i)
              for x in matched2:
                  meshes.append((buckets[0][1][x], buckets[1][0][x]))
              for x in matched2:
                  del buckets[0][1][x]
                  del buckets[1][0][x]
  
      meshes = [(formatstring.format(num), formatstring.format(num2))
                for (num, num2) in meshes]
      if display:
          print "meshes:"
          print meshes
      if stdOutput:
          return 100 * float(len(meshes)) / len(strings)
      return len(meshes)
function_tokens: def doubleSplittingMesher ( strings , attempts , display = False , stdOutput = False ) : if display : print "using double Splitting Mesher" buckets = [ [ ] , [ ] ] , [ [ ] , [ ] ] length = len ( strings [ 0 ] ) numStrings = len ( strings ) splittingString1 = ( "1" * ( length / 2 ) ) + ( "0" * ( length / 2 ) ) splittingString2 = ( "10" * ( length / 2 ) ) for string in strings : s = long ( string , base = 2 ) diff = hamming ( string , splittingString1 ) diff2 = hamming ( string , splittingString2 ) if diff < int ( length * 0.5 ) : id1 = 0 elif diff == int ( length * 0.5 ) : if random . randint ( 0 , 1 ) : id1 = 0 else : id1 = 1 else : id1 = 1 if diff2 < int ( length * 0.5 ) : id2 = 0 elif diff == int ( length * 0.5 ) : if random . randint ( 0 , 1 ) : id2 = 0 else : id2 = 1 else : id2 = 1 buckets [ id1 ] [ id2 ] . append ( s ) formatstring = "{0:0" + str ( length ) + "b}" for layer in buckets : for thing in layer : print len ( thing ) #    print buckets meshes = [ ] check1 = True check2 = True for k in range ( attempts ) : dim1 = min ( len ( buckets [ 0 ] [ 0 ] ) , len ( buckets [ 1 ] [ 1 ] ) ) dim2 = min ( len ( buckets [ 0 ] [ 1 ] ) , len ( buckets [ 1 ] [ 0 ] ) ) #        print dim1, dim2 if dim1 == 0 : if check1 : print 'found meshes for everything in set 1, so stopped after {} attempts' . format ( k ) check1 = False else : matched1 = [ ] if dim1 == 1 : num1 = buckets [ 0 ] [ 0 ] [ 0 ] num2 = buckets [ 1 ] [ 1 ] [ 0 ] if num1 & num2 == 0 : matched1 . append ( 0 ) for i in range ( dim1 - 1 , 0 , - 1 ) : num1 = buckets [ 0 ] [ 0 ] [ i ] num2 = buckets [ 1 ] [ 1 ] [ i ] if num1 & num2 == 0 : matched1 . append ( i ) for x in matched1 : meshes . append ( ( buckets [ 0 ] [ 0 ] [ x ] , buckets [ 1 ] [ 1 ] [ x ] ) ) for x in matched1 : del buckets [ 0 ] [ 0 ] [ x ] del buckets [ 1 ] [ 1 ] [ x ] if dim2 == 0 : if check2 : print 'found meshes for everything in set 2, so stopped after {} attempts' . format ( k ) check2 = False else : matched2 = [ ] if dim2 == 1 : num1 = buckets [ 0 ] [ 1 ] [ 0 ] num2 = buckets [ 1 ] [ 0 ] [ 0 ] if num1 & num2 == 0 : matched2 . append ( 0 ) for i in range ( dim2 - 1 , 0 , - 1 ) : num1 = buckets [ 0 ] [ 1 ] [ i ] num2 = buckets [ 1 ] [ 0 ] [ i ] if num1 & num2 == 0 : matched2 . append ( i ) for x in matched2 : meshes . append ( ( buckets [ 0 ] [ 1 ] [ x ] , buckets [ 1 ] [ 0 ] [ x ] ) ) for x in matched2 : del buckets [ 0 ] [ 1 ] [ x ] del buckets [ 1 ] [ 0 ] [ x ] meshes = [ ( formatstring . format ( num ) , formatstring . format ( num2 ) ) for ( num , num2 ) in meshes ] if display : print "meshes:" print meshes if stdOutput : return 100 * float ( len ( meshes ) ) / len ( strings ) return len ( meshes )