diff --git a/02/b.py b/02/b.py new file mode 100644 index 0000000..2fbf7ee --- /dev/null +++ b/02/b.py @@ -0,0 +1,25 @@ +import os + +f = open(os.path.dirname(__file__)+"/input.txt", "r") + +tot = 0 + +selection = {'X': 1, 'Y': 2, 'Z': 3} + +for l in f: + choices = l.split(" ") + result = 'draw' + + match choices[0]: + case 'A': + match choices[1]: + case 'Y': + result = 'win' + case 'Z': + result = 'loss' + + tot = tot + selection.get(choices[1]) + if result == 'draw': + tot = tot + 3 + if result == 'win': + tot = tot + 6