修复5张以上的炸弹BUG
This commit is contained in:
parent
e017c3724d
commit
7bc1e527c3
|
@ -24,8 +24,8 @@ def get_move_type(move):
|
||||||
if move_size == 2:
|
if move_size == 2:
|
||||||
if move[0] == move[1]:
|
if move[0] == move[1]:
|
||||||
return {'type': TYPE_2_PAIR, 'rank': move[0]}
|
return {'type': TYPE_2_PAIR, 'rank': move[0]}
|
||||||
elif move == [20, 30]: # Kings
|
# elif move == [20, 30]: # Kings
|
||||||
return {'type': TYPE_5_KING_BOMB}
|
# return {'type': TYPE_5_KING_BOMB}
|
||||||
else:
|
else:
|
||||||
return {'type': TYPE_15_WRONG}
|
return {'type': TYPE_15_WRONG}
|
||||||
|
|
||||||
|
@ -39,8 +39,10 @@ def get_move_type(move):
|
||||||
if len(move_dict) == 1:
|
if len(move_dict) == 1:
|
||||||
return {'type': TYPE_4_BOMB, 'rank': move[0]}
|
return {'type': TYPE_4_BOMB, 'rank': move[0]}
|
||||||
elif len(move_dict) == 2:
|
elif len(move_dict) == 2:
|
||||||
if move[0] == move[1] == move[2] or move[1] == move[2] == move[3]:
|
if move[0] == 20 and move[2] == 30: # Kings
|
||||||
return {'type': TYPE_6_3_1, 'rank': move[1]}
|
return {'type': TYPE_5_KING_BOMB}
|
||||||
|
# if move[0] == move[1] == move[2] or move[1] == move[2] == move[3]:
|
||||||
|
# return {'type': TYPE_6_3_1, 'rank': move[1]}
|
||||||
else:
|
else:
|
||||||
return {'type': TYPE_15_WRONG}
|
return {'type': TYPE_15_WRONG}
|
||||||
else:
|
else:
|
||||||
|
@ -50,7 +52,9 @@ def get_move_type(move):
|
||||||
return {'type': TYPE_8_SERIAL_SINGLE, 'rank': move[0], 'len': len(move)}
|
return {'type': TYPE_8_SERIAL_SINGLE, 'rank': move[0], 'len': len(move)}
|
||||||
|
|
||||||
if move_size == 5:
|
if move_size == 5:
|
||||||
if len(move_dict) == 2:
|
if len(move_dict) == 1:
|
||||||
|
return {'type': TYPE_4_BOMB5, 'rank': move[0]}
|
||||||
|
elif len(move_dict) == 2:
|
||||||
return {'type': TYPE_7_3_2, 'rank': move[2]}
|
return {'type': TYPE_7_3_2, 'rank': move[2]}
|
||||||
else:
|
else:
|
||||||
return {'type': TYPE_15_WRONG}
|
return {'type': TYPE_15_WRONG}
|
||||||
|
@ -60,13 +64,21 @@ def get_move_type(move):
|
||||||
count_dict[n] += 1
|
count_dict[n] += 1
|
||||||
|
|
||||||
if move_size == 6:
|
if move_size == 6:
|
||||||
if (len(move_dict) == 2 or len(move_dict) == 3) and count_dict.get(4) == 1 and \
|
if len(move_dict) == 1:
|
||||||
(count_dict.get(2) == 1 or count_dict.get(1) == 2):
|
return {'type': TYPE_4_BOMB6, 'rank': move[0]}
|
||||||
return {'type': TYPE_13_4_2, 'rank': move[2]}
|
# if (len(move_dict) == 2 or len(move_dict) == 3) and count_dict.get(4) == 1 and \
|
||||||
|
# (count_dict.get(2) == 1 or count_dict.get(1) == 2):
|
||||||
|
# return {'type': TYPE_13_4_2, 'rank': move[2]}
|
||||||
|
|
||||||
if move_size == 8 and (((len(move_dict) == 3 or len(move_dict) == 2) and
|
# if move_size == 8 and (((len(move_dict) == 3 or len(move_dict) == 2) and
|
||||||
(count_dict.get(4) == 1 and count_dict.get(2) == 2)) or count_dict.get(4) == 2):
|
# (count_dict.get(4) == 1 and count_dict.get(2) == 2)) or count_dict.get(4) == 2):
|
||||||
return {'type': TYPE_14_4_22, 'rank': max([c for c, n in move_dict.items() if n == 4])}
|
# return {'type': TYPE_14_4_22, 'rank': max([c for c, n in move_dict.items() if n == 4])}
|
||||||
|
|
||||||
|
if move_size == 7 and len(move_dict) == 1:
|
||||||
|
return {'type': TYPE_4_BOMB7, 'rank': move[0]}
|
||||||
|
|
||||||
|
if move_size == 8 and len(move_dict) == 1:
|
||||||
|
return {'type': TYPE_4_BOMB8, 'rank': move[0]}
|
||||||
|
|
||||||
mdkeys = sorted(move_dict.keys())
|
mdkeys = sorted(move_dict.keys())
|
||||||
if len(move_dict) == count_dict.get(2) and is_continuous_seq(mdkeys):
|
if len(move_dict) == count_dict.get(2) and is_continuous_seq(mdkeys):
|
||||||
|
@ -93,15 +105,15 @@ def get_move_type(move):
|
||||||
|
|
||||||
serial_3.sort()
|
serial_3.sort()
|
||||||
if is_continuous_seq(serial_3):
|
if is_continuous_seq(serial_3):
|
||||||
if len(serial_3) == len(single)+len(pair)*2:
|
# if len(serial_3) == len(single)+len(pair)*2:
|
||||||
return {'type': TYPE_11_SERIAL_3_1, 'rank': serial_3[0], 'len': len(serial_3)}
|
# return {'type': TYPE_11_SERIAL_3_1, 'rank': serial_3[0], 'len': len(serial_3)}
|
||||||
if len(serial_3) == len(pair) and len(move_dict) == len(serial_3) * 2:
|
if len(serial_3) == len(pair) and len(move_dict) == len(serial_3) * 2:
|
||||||
return {'type': TYPE_12_SERIAL_3_2, 'rank': serial_3[0], 'len': len(serial_3)}
|
return {'type': TYPE_12_SERIAL_3_2, 'rank': serial_3[0], 'len': len(serial_3)}
|
||||||
|
|
||||||
if len(serial_3) == 4:
|
# if len(serial_3) == 4:
|
||||||
if is_continuous_seq(serial_3[1:]):
|
# if is_continuous_seq(serial_3[1:]):
|
||||||
return {'type': TYPE_11_SERIAL_3_1, 'rank': serial_3[1], 'len': len(serial_3) - 1}
|
# return {'type': TYPE_11_SERIAL_3_1, 'rank': serial_3[1], 'len': len(serial_3) - 1}
|
||||||
if is_continuous_seq(serial_3[:-1]):
|
# if is_continuous_seq(serial_3[:-1]):
|
||||||
return {'type': TYPE_11_SERIAL_3_1, 'rank': serial_3[0], 'len': len(serial_3) - 1}
|
# return {'type': TYPE_11_SERIAL_3_1, 'rank': serial_3[0], 'len': len(serial_3) - 1}
|
||||||
|
|
||||||
return {'type': TYPE_15_WRONG}
|
return {'type': TYPE_15_WRONG}
|
||||||
|
|
Loading…
Reference in New Issue