Skip to content

Commit 7b944f1

Browse files
committed
Merge branch 'main' of github.com:askrepps/advent-of-code-2020 into main
2 parents 7c5aed1 + 4e59ba5 commit 7b944f1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

advent2020/day22.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
# SOFTWARE.
22-
import copy
22+
23+
2324
import sys
2425

2526
from . import util
@@ -81,9 +82,9 @@ def play_game(all_decks, allow_recursion=False, encountered_deck_states=None):
8182
should_recurse = False
8283
break
8384
if should_recurse:
84-
sub_decks = copy.deepcopy(all_decks)
85+
sub_decks = []
8586
for player_idx, card in played_cards:
86-
sub_decks[player_idx] = sub_decks[player_idx][-card:]
87+
sub_decks.append(all_decks[player_idx][-card:])
8788
winning_player_idx, _ = play_game(sub_decks, encountered_deck_states)
8889
give_cards_to_winner(all_decks, played_cards, winning_player_idx)
8990
else:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy