Juan José Gutiérrez de Quevedo Pérez 4 months ago
parent
commit
9c24543479
2 changed files with 6 additions and 8 deletions
  1. 4 6
      22/1.py
  2. 2 2
      22/2.py

+ 4 - 6
22/1.py

@@ -8,11 +8,11 @@ for c in content:
     if not c:
         part += 1
         continue
-    if part == 0: # reading player 2 stack
+    if part == 0: # reading player 1 stack
         if c.startswith("Player"):
             continue
         player1.append(int(c))
-    if part == 1: # reading player 1 stack
+    if part == 1: # reading player 2 stack
         if c.startswith("Player"):
             continue
         player2.append(int(c))
@@ -21,13 +21,11 @@ while len(player1) and len(player2):
     if player1[0] > player2[0]:
         player1.append(player1[0])
         player1.append(player2[0])
-        del(player1[0])
-        del(player2[0])
     else:
         player2.append(player2[0])
         player2.append(player1[0])
-        del(player1[0])
-        del(player2[0])
+    del(player1[0])
+    del(player2[0])
 
 if len(player1):
     winner = player1

+ 2 - 2
22/2.py

@@ -8,11 +8,11 @@ for c in content:
     if not c:
         part += 1
         continue
-    if part == 0: # reading player 2 stack
+    if part == 0: # reading player 1 stack
         if c.startswith("Player"):
             continue
         player1.append(int(c))
-    if part == 1: # reading player 1 stack
+    if part == 1: # reading player 2 stack
         if c.startswith("Player"):
             continue
         player2.append(int(c))