You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

194 lines
6.6 KiB

6 months ago
WIDTH, HEIGHT = 800, 615
RED = (255, 48, 48)
BLUE = (65, 105, 225)
GREEN = (0, 139, 0)
board = [[' '] * 15 for line in range(15)]
# 棋型编号
# 第一位是主棋子的数量
# 第二位是一级棋型编号,规则是连在一起的主棋子有多到少
# 第三位是二级棋型编号规则是从左向右修改先修改空格再添加对方棋子比如O
value_model_X_test = {
'5': {
'5': ('XXXXX', 1000)
},
'4': {
'4p_0': (' XXXX ', 400),
'4_0_1_e': (' XXXX', 100), # 结尾
'4_0_2': (' XXXXO', 100),
'4_0_3_s': ('XXXX ', 100), # 开头
'4_0_4': ('OXXXX ', 100),
'4_1_e': (' XXX X', 120), # 结尾
'4_1_1': (' XXX XO', 120),
'4_1_2_e': (' XXX X', 101), # 结尾
'4_1_3': (' XXX XO', 101),
'4_1_4_s': ('XXX X', 100), # 无需在结尾检测,因为结尾的情况已枚举完毕
'4_1_6_e': ('OXXX X', 100), # 结尾
'4_1_7': ('OXXX XO', 100),
'4_2': (' XX XX ', 110),
'4_2_1': (' XX XX ', 108),
'4_2_2': (' XX XX ', 106),
'4_2_3_e': (' XX XX', 105), # 结尾
'4_2_4': (' XX XXO', 105),
'4_2_5': (' XX XX ', 108),
'4_2_6': (' XX XX ', 106),
'4_2_7': (' XX XX ', 104),
'4_2_8_e': (' XX XX', 102), # 结尾
'4_2_9': (' XX XXO', 102),
'4_2_10': (' XX XX ', 106),
'4_2_11': (' XX XX ', 103),
'4_2_12': (' XX XX ', 102),
'4_2_13_e': (' XX XX', 101), # 结尾
'4_2_14': (' XX XXO', 101),
'4_2_15_s': ('XX XX ', 105), # 开头
'4_2_16_s': ('XX XX ', 102), # 开头
'4_2_17_s': ('XX XX ', 101), # 开头
'4_2_19_s': ('XX XXO', 100), # 开头
'4_2_20': ('OXX XX ', 105),
'4_2_21': ('OXX XX ', 102),
'4_2_22': ('OXX XX ', 101),
'4_2_23_e': ('OXX XX', 100), # 结尾
'4_2_24': ('OXX XXO', 100),
'4_3': (' X XXX ', 121),
'4_3_1': (' X XXX ', 102),
'4_3_2_e': (' X XXX', 101),
'4_3_3': (' X XXXO', 101),
'4_3_4_s': ('X XXX ', 120), # 开头
'4_3_5_s': ('X XXX ', 101), # 开头
'4_3_6_e': ('OX XXX', 100),
'4_3_7_s': ('X XXXO', 100), # 开头
'4_3_8': ('OX XXX ', 120),
'4_3_9': ('OX XXX ', 101),
'4_3_10': ('OX XXXO', 100),
},
'3': {
'3p_0': (' XXX ', 60),
'3p_0_1': (' XXX ', 30),
'3_0_2_e': (' XXX', 25), # 结尾
'3_0_3': (' XXXO', 25),
'3p_0_4': (' XXX ', 30),
'3_0_5': (' XXX ', 25),
'3_0_6_s': ('XXX ', 25), # 开头
'3_0_7': ('OXXX ', 25),
'3p_1': (' XX X ', 37),
'3_1_1_e': (' XX X', 27), # 结尾
'3_1_2': (' XX XO', 27),
'3p_1_3': (' XX X ', 31),
'3_1_4_e': (' XX X', 26), # 结尾
'3_1_5': (' XX XO', 26),
'3p_1_6': (' XX X ', 30),
'3_1_7_e': (' XX X', 25), # 结尾
'3_1_8': (' XX XO', 25),
'3_1_9_s': ('XX X ', 25), # 开头
'3_1_10': ('OXX X ', 25),
'3p_2': (' X XX ', 37),
'3p_2_1': (' X XX ', 31),
'3p_2_2': (' X XX ', 30),
'3p_2_3_e': (' X XX', 25), # 结尾
'3_2_4': (' X XXO', 25),
'3_2_5_s': ('X XX ', 27), # 开头
'3_2_6_s': ('X XX ', 26), # 开头
'3_2_7_s': ('X XX ', 25), # 开头
'3_2_8': ('OX XX ', 27),
'3_2_9': ('OX XX ', 26),
'3_2_10': ('OX XX ', 25),
'3_3': (' X X X ', 27),
'3_3_1': (' X X X ', 26),
'3_3_2_e': (' X X X', 25), # 结尾
'3_3_3': (' X X XO', 25),
'3_3_4': (' X X X ', 26),
'3_3_5': (' X X X ', 25),
'3_3_6_e': (' X X X', 24), # 结尾
'3_3_7': (' X X XO', 24),
'3_3_8_s': ('X X X ', 25), # 开头
'3_3_9_s': ('X X X ', 24), # 开头
'3_3_10_s': ('X X XO', 24), # 开头
'3_3_11': ('OX X X ', 25),
'3_3_12': ('OX X X ', 24),
'3_3_13_e': ('OX X X', 23), # 结尾
'3_3_14': ('OX X XO', 23),
},
'2': {
'2_0': (' XX ', 8),
'2_0_1': (' XX ', 4),
'2_0_2': (' XX ', 3),
'2_0_3_e': (' XX', 1), # 结尾
'2_0_4': (' XXO', 1),
'2_0_5': (' XX ', 4),
'2_0_6': (' XX ', 3),
'2_0_7': (' XX ', 2),
'2_0_8': (' XX ', 3),
'2_0_9': (' XX ', 2),
'2_0_10_s': ('XX ', 1), # 开头
'2_0_11': ('OXX ', 1),
'2_1': (' X X ', 4),
'2_1_1': (' X X ', 3),
'2_1_2_e': (' X X', 1), # 结尾
'2_1_3': (' X XO', 1),
'2_1_4': (' X X ', 3),
'2_1_5': (' X X ', 2),
'2_1_6_s': ('X X ', 1), # 开头
'2_1_7': ('OX X ', 1),
'2_2': (' X X ', 4),
'2_2_1': (' X X ', 3),
'2_2_2_e': (' X X', 2),
'2_2_3': (' X XO', 2),
'2_2_4': (' X X ', 3),
'2_2_5': (' X X ', 2),
'2_2_6_e': (' X X', 1),
'2_2_7': (' X XO', 1),
'2_2_8_s': ('X X ', 2),
'2_2_9_s': ('X X ', 1),
'2_2_10': ('OX X ', 1),
'2_2_11': ('OX X ', 1),
'2_3': (' X X ', 3),
'2_3_1_e': (' X X', 2),
'2_3_2': (' X XO', 2),
'2_3_3_s': ('X X ', 2),
'2_3_4_s': ('X X', 1),
'2_3_5_s': ('X XO', 1),
'2_3_6': ('OX X ', 2),
'2_3_7_e': ('OX X', 1),
'2_3_8': ('OX XO', 1)
}
}
value_model_O_test = \
{_[0]: {s[0]: (s[1][0].replace('O', '*').replace('X', 'O').replace('*', 'X'), s[1][1]) for s in _[1].items()}
for _ in value_model_X_test.items()}
value_model_X = [
{_[0]: [s for s in _[1].items() if s[0][-1] in ['s'] + [str(_) for _ in list(range(10))]]
for _ in value_model_X_test.items()},
{_[0]: [s for s in _[1].items() if s[0][-1] in [str(_) for _ in list(range(10))]]
for _ in value_model_X_test.items()},
{_[0]: [s for s in _[1].items() if s[0][-1] in ['e'] + [str(_) for _ in list(range(10))]]
for _ in value_model_X_test.items()}
]
value_model_O = [
{_[0]: [s for s in _[1].items() if s[0][-1] in ['s'] + [str(_) for _ in list(range(10))]]
for _ in value_model_O_test.items()},
{_[0]: [s for s in _[1].items() if s[0][-1] in [str(_) for _ in list(range(10))]]
for _ in value_model_O_test.items()},
{_[0]: [s for s in _[1].items() if s[0][-1] in ['e'] + [str(_) for _ in list(range(10))]]
for _ in value_model_O_test.items()}
]
if __name__ == '__main__':
# print(value_model_X)
# print(value_model_O)
test_l = [t for _ in value_model_X_test.items() for t in _[1].items()]
print(len(test_l))