示例#1
0
文件: trice.py 项目: bgnori/bglib
def t2k(t):
  us, them = t
  if True:
    xs = [(us[i], them[i]) for i in range(6)]
    xs = list()
    for i, j in zip(us, them):
      xs.append(i)
      xs.append(j)
  else:
    xs = tuple(reversed(us + them))

  c = count(xs)
  if c == 0:
    return 0
  elif c == 1:
    b = [0]
    for i in xs:
      b += [1 for j in range(i)]
      b.append(0)
    return 1 + C_Hash(b, c)
  else:
    b = [0]
    for i in xs:
      b += [1 for j in range(i)]
      b.append(0)
    return D(c - 1, 7) ** 2 + C_Hash(b, c)
示例#2
0
文件: nori.py 项目: bgnori/bglib
def oneside_upto6_t2k(t):
  assert len(t) == 6
  xs = []
  c = count(t)
  for i in t:
    xs += [1 for j in  range(i)]
    xs.append(0)

  #C_Hash treats  highest bit as Least Significant bit
  xs.reverse()
  return sigmaD[c-1] + C_Hash(xs, c)
示例#3
0
文件: gnubgdb.py 项目: bgnori/bglib
def bearoff_param(us, them):
  return max(backward(us), backward(them), 0), \
         max(count(us), count(them), 0)