You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a private method responsible for taking the list of values [0,...,10,JACK,QUEEN, KING] and list of suits, and the name of a card [1 of clubs etc]. So it does the math to return the position of the card in a simple deck.
I believe the easiest way is to remove all the private methods here and then on the english (and portuguese) initiation method you can iterate over the numbers 1 to 52, invoke self.card_name(k). The result of that call can be cached in a self._cached_names. So the method name_to_position becomes a simple look up in the self._cached_names dictionary
It could use a simple cached hash map (dictionary) for quick lookup, no comparisons done.
The text was updated successfully, but these errors were encountered: