summaryrefslogtreecommitdiff
path: root/wires.py
diff options
context:
space:
mode:
Diffstat (limited to 'wires.py')
-rwxr-xr-xwires.py49
1 files changed, 49 insertions, 0 deletions
diff --git a/wires.py b/wires.py
new file mode 100755
index 0000000..cf754df
--- /dev/null
+++ b/wires.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python3
+import sys
+
+def ask(s):
+ print("\x1B[1m" + s + "\x1B[0m: ", end="")
+ return int(input())
+
+A = sys.argv[1]
+if len(A) == 3:
+ if "r" not in A:
+ print("second")
+ elif A[-1] == "w":
+ print("last")
+ elif A.count("b") > 1:
+ print("last blue")
+ else:
+ print("last")
+
+elif len(A) == 4:
+ if A.count("r") > 1 and ask("last digit serial number") % 2 == 1:
+ print("last red")
+ elif A[-1] == "g" and "r" not in A:
+ print("first")
+ elif A.count("b") == 1:
+ print("first")
+ elif A.count("g") > 1:
+ print("last")
+ else:
+ print("second")
+
+elif len(A) == 5:
+ if A[-1] == "z" and ask("last digit serial number") % 2 == 1:
+ print("fourth")
+ elif A.count("r") == 1 and A.count("g") > 1:
+ print("first")
+ elif "z" not in A:
+ print("second")
+ else:
+ print("first")
+
+elif len(A) == 6:
+ if "g" not in A and ask("last digit serial number") % 2 == 1:
+ print("third")
+ elif A.count("g") == 1 and A.count("w") > 1:
+ print("fourth")
+ elif "r" not in A:
+ print("last")
+ else:
+ print("fourth")