33# SPDX-License-Identifier: MIT
44import os
55import random
6+ import sys
67import time
78from io import BytesIO
89
@@ -133,7 +134,10 @@ class Match3Card(Group):
133134
134135 def __init__ (self , card_tuple , ** kwargs ):
135136 # tile palette mapper to color the card
136- self ._mapper = TilePaletteMapper (kwargs ["pixel_shader" ], 5 )
137+ if sys .implementation .version [0 ] == 9 :
138+ self ._mapper = TilePaletteMapper (kwargs ["pixel_shader" ], 5 , 1 , 1 )
139+ elif sys .implementation .version [0 ] >= 10 :
140+ self ._mapper = TilePaletteMapper (kwargs ["pixel_shader" ], 5 )
137141 kwargs ["pixel_shader" ] = self ._mapper
138142 # tile grid to for the visible sprite
139143 self ._tilegrid = TileGrid (** kwargs )
@@ -580,9 +584,11 @@ def handle_left_click(self, player_index, coords):
580584 # if 3 cards have been clicked
581585 if len (self .clicked_cards ) == 3 :
582586 # check if the 3 cards make a valid set
583- valid_set = validate_set (self .clicked_cards [0 ],
584- self .clicked_cards [1 ],
585- self .clicked_cards [2 ])
587+ valid_set = validate_set (
588+ self .clicked_cards [0 ],
589+ self .clicked_cards [1 ],
590+ self .clicked_cards [2 ],
591+ )
586592
587593 # if they are a valid set
588594 if valid_set :
@@ -660,7 +666,9 @@ def handle_left_click(self, player_index, coords):
660666 # load the game from the given game state
661667 self .load_from_game_state (self .game_state )
662668 # hide the title screen
663- self .title_screen .hidden = True # pylint: disable=attribute-defined-outside-init
669+ self .title_screen .hidden = (
670+ True # pylint: disable=attribute-defined-outside-init
671+ )
664672 # set the current state to open play
665673 self .cur_state = STATE_PLAYING_OPEN
666674
@@ -676,7 +684,9 @@ def handle_left_click(self, player_index, coords):
676684 # initialize a new game
677685 self .init_new_game ()
678686 # hide the title screen
679- self .title_screen .hidden = True # pylint: disable=attribute-defined-outside-init
687+ self .title_screen .hidden = (
688+ True # pylint: disable=attribute-defined-outside-init
689+ )
680690 # set the current state to open play
681691 self .cur_state = STATE_PLAYING_OPEN
682692
0 commit comments