Skip to content Skip to sidebar Skip to footer

How Can I Deepcopy A Pygame Sprite Group?

I am trying to implement a chess AI using a monte carlo tree search. This requires playing through 800 random games from each position to evaluate the value of each move. However,

Solution 1:

.copy() creates a new group, which contains the same sprites as the group, but the sprites are not (deep) copied.

You can use .remove() to remove a Sprite from a single pygame.sprite.Group:

for piece in piece_list_copy:
    piece_list.remove(piece)

Post a Comment for "How Can I Deepcopy A Pygame Sprite Group?"