-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from rahul-nanwani/v3-0-0
v3.0.0
- Loading branch information
Showing
9 changed files
with
469 additions
and
236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[metadata] | ||
name = blackjack21 | ||
version = 2.0.1 | ||
version = 3.0.0 | ||
author = Rahul Nanwani | ||
author_email = [email protected] | ||
description = A complete package for blackjack, with max 5 players on a table, double down, and split features too. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
__all__ = ( | ||
"InvalidSuits", | ||
"InvalidRanks", | ||
"PlayDealerFailure", | ||
"PlayFailure", | ||
"InvalidPlayersData", | ||
) | ||
|
||
class BlackjackException(Exception): | ||
"""Blackjack base class exception""" | ||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args) | ||
|
||
|
||
class InvalidSuits(BlackjackException): | ||
"""Raised when length of suits tuple is not 4""" | ||
def __init__(self, suits: tuple): | ||
super().__init__(f"Failed to create Deck.\nExpected 4 suits but got {len(suits)} suits instead.") | ||
|
||
|
||
class InvalidRanks(BlackjackException): | ||
"""Raised when length of ranks tuple is not 13""" | ||
def __init__(self, ranks: tuple): | ||
super().__init__(f"Failed to create Deck.\nExpected 13 ranks but got {len(ranks)} ranks instead.") | ||
|
||
|
||
class PlayFailure(BlackjackException): | ||
"""Raised when player tries to play double down/split when they are not eligible""" | ||
def __init__(self, name: str, action: str): | ||
super().__init__(f"Attempted to play {action}.\n{name} is not eligible to play this.") | ||
|
||
|
||
class PlayDealerFailure(BlackjackException): | ||
def __init__(self, name: str): | ||
"""Raised when dealer tries to play own hand before all the player(s) have finished their hand(s)""" | ||
super().__init__(f"Failed to play dealer.\n{name} has not finished playing their hand yet.") | ||
|
||
class InvalidPlayersData(BlackjackException): | ||
"""Raised when the input player data is invalid""" | ||
def __init__(self): | ||
super().__init__(f"Players should have both names and bet amounts.") |
Oops, something went wrong.