-
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.
Create player class, implement some prompt methods
- Loading branch information
Showing
3 changed files
with
84 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
from decimal import Decimal | ||
|
||
class Player(): | ||
|
||
def __init__(self, player_number: int, start_dollars: Decimal): | ||
""" | ||
Create a player with the given starting amount of money, | ||
""" | ||
self.player_number = player_number | ||
self.dollars_remaining = start_dollars |
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,19 @@ | ||
|
||
def get_integer_input(blurb: str, prompt: str): | ||
""" | ||
Prompts the user to enter a bet amount as an integer, and returns the amount | ||
once an integer is input. | ||
Args: | ||
blurb (str): The string printed before input | ||
prompt (str): The string printed on the same line as the input | ||
Returns: | ||
[int]: The integer the user input | ||
""" | ||
input_amt = None | ||
print(blurb) | ||
while input_amt is None or not input_amt.isnumeric(): | ||
input_amt = input(prompt) | ||
|
||
return int(input_amt) |