From 679481ea233b43ff55e19ff8d321cc00b31697bc Mon Sep 17 00:00:00 2001 From: Thomas Kwashnak Date: Thu, 13 Jan 2022 08:41:13 -0500 Subject: [PATCH] Simplified / Shortened move script --- 48_High_IQ/python/High_IQ.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/48_High_IQ/python/High_IQ.py b/48_High_IQ/python/High_IQ.py index 548d984d..0f39b9d4 100644 --- a/48_High_IQ/python/High_IQ.py +++ b/48_High_IQ/python/High_IQ.py @@ -61,19 +61,14 @@ def move(board): return False end = int(input("TO WHERE? ")) - if not (board[end] == 'O'): - return False difference = abs(end - start) - if difference != 2 and difference != 18: - return False center = (end + start) / 2 - if not board[center] == '!': - return False - board[start] = 'O' - board[center] = 'O' - board[end] = '!' - return True + if (difference == 2 or difference == 18) and board[end] == 'O' and board[center] == '!': + board[start] = 'O' + board[center] = 'O' + board[end] == '!' + return True except: return False