summaryrefslogtreecommitdiff
path: root/2022/day2/day2.py
diff options
context:
space:
mode:
authornekineki <nekineki@nekineki.net>2022-12-11 14:47:27 +0100
committernekineki <nekineki@nekineki.net>2022-12-11 14:50:32 +0100
commitfe75c10e350743a1c078f065d69556fecf825ca5 (patch)
tree956556a564c9329346dc9d8b1535dc5e365f3d55 /2022/day2/day2.py
parenta74d2dc54aef546664bcc8c81eb8e01a93e94391 (diff)
move files around, update paths
Diffstat (limited to '2022/day2/day2.py')
-rwxr-xr-x2022/day2/day2.py62
1 files changed, 0 insertions, 62 deletions
diff --git a/2022/day2/day2.py b/2022/day2/day2.py
deleted file mode 100755
index 727bb31..0000000
--- a/2022/day2/day2.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/env python3
-
-import math
-import time
-
-score1 = 0
-score2 = 0
-
-# filename = "input_test.txt"
-filename = "input.txt"
-with open(filename) as f:
- for line in f:
- line = line.strip()
- abc, xyz = line[0], line[2]
-
- if abc == 'A':
- abc = 1
- elif abc == 'B':
- abc = 2
- elif abc == 'C':
- abc = 3
- else:
- print('ERROR')
-
- if xyz == 'X':
- xyz = 1
- elif xyz == 'Y':
- xyz = 2
- elif xyz == 'Z':
- xyz = 3
- else:
- print('ERROR')
-
- s1 = 0
- if abc == xyz:
- print('draw')
- s1 = 3 + xyz
- # elif ((xyz + 1)%3) + 1 == abc:
- elif abc%3 + 1 == xyz:
- print('win')
- s1 = 6 + xyz
- else:
- print('lose')
- s1 = 0 + xyz
- print('s1', s1)
- score1 += s1
-
- if xyz == 1:
- # lose
- s2 = 0 + (abc-1 + 2)%3 + 1
- elif xyz == 2:
- # draw
- s2 = 3 + abc
- elif xyz == 3:
- # win
- s2 = 6 + (abc-1 + 1)%3 + 1
- print('s2', s2)
- score2 += s2
-
- print('score1', score1)
- print('score2', score2)
-