MCPcopy Create free account
hub / github.com/9chu/LuaSTGPlus / find_best_indices

Function find_best_indices

LuaSTGPlus/string2enum.py:56–74  ·  view source on GitHub ↗
(key_list)

Source from the content-addressed store, hash-verified

54# find best indices
55# !!NEED TO BE IMPROVED!!
56def find_best_indices(key_list):
57 n = maxlen(key_list)
58 seq = [x for x in range(0, n)]
59 for cnt in range(1, n + 1):
60 for comb in combination(seq, cnt):
61 test_set = set()
62 fail = False
63 for key in key_list:
64 comb_str = ""
65 for idx in comb:
66 comb_str += charat(key, idx)
67 if comb_str in test_set:
68 fail = True
69 break
70 test_set.add(comb_str)
71 if not fail:
72 print("*** Best indices found: " + str(comb))
73 return comb
74 return None
75
76def keyhash(key, rand_table, idx_list, n):
77 ret = 0

Callers 1

generated_mpfFunction · 0.85

Calls 3

maxlenFunction · 0.85
combinationFunction · 0.85
charatFunction · 0.85

Tested by

no test coverage detected