Compare commits
2 Commits
d57022f742
...
blacktui
| Author | SHA1 | Date | |
|---|---|---|---|
| 084cfd0b9a | |||
| e2c99dfea4 |
23
src/asciimatics/ascii.py
Normal file
23
src/asciimatics/ascii.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from asciimatics.screen import Screen
|
||||
from asciimatics.scene import Scene
|
||||
from asciimatics.effects import Cycle, Stars
|
||||
from asciimatics.renderers import FigletText
|
||||
|
||||
|
||||
def demo(screen):
|
||||
effects = [
|
||||
Cycle(
|
||||
screen,
|
||||
FigletText("Asciimatics", font="big"),
|
||||
screen.height // 2 - 8,
|
||||
),
|
||||
Cycle(
|
||||
screen,
|
||||
FigletText("ROCKS", font="big"),
|
||||
screen.height // 2 + 3,
|
||||
),
|
||||
]
|
||||
screen.play([Scene(effects, 500)])
|
||||
|
||||
|
||||
Screen.wrapper(demo)
|
||||
12
src/asciimatics/screen.py
Normal file
12
src/asciimatics/screen.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from asciimatics.screen import ManagedScreen
|
||||
from time import sleep
|
||||
|
||||
|
||||
@ManagedScreen
|
||||
def demo(screen):
|
||||
screen.print_at("Hello world", 0, 0)
|
||||
screen.refresh()
|
||||
sleep(10)
|
||||
|
||||
|
||||
demo()
|
||||
@@ -11,8 +11,8 @@ class Game:
|
||||
def __init__(self) -> None:
|
||||
"""Creates instances of 'Deck', 'Player', and 'Dealer'."""
|
||||
self.deck = Deck()
|
||||
self.player = Player(0)
|
||||
self.dealer = Dealer(1000)
|
||||
self.player = Player(100)
|
||||
self.dealer = Dealer(10000)
|
||||
|
||||
def compare_hands(self, bet: float) -> str:
|
||||
"""*Resolution/Payout*: Compares final hand values, checks for
|
||||
@@ -103,6 +103,20 @@ class Game:
|
||||
player = self.player
|
||||
dealer = self.dealer
|
||||
|
||||
# TODO: implement logic for setting the bet and passing the
|
||||
# value to the hand comparison. Also keep the chip ammount of
|
||||
# the player over multiple rounds.
|
||||
|
||||
# player starts with x amount and bets per round from his
|
||||
# current chips. Internally the chips are handled as a float
|
||||
# the player gets to see the float number as 'IS' and the
|
||||
# rounded down number as 'Payout'
|
||||
|
||||
# HACK: this is just to fuck around and find out...
|
||||
|
||||
player_bet = input("How much do you want to bet?")
|
||||
# player.chips += float(player_bet)
|
||||
|
||||
# Beginning of the round, the deck gets shuffled and all the
|
||||
# player cards are shown, while the dealer only shows one card.
|
||||
deck.shuffle()
|
||||
@@ -131,7 +145,9 @@ class Game:
|
||||
|
||||
# Comparing hands and returning the winner of the game.
|
||||
os.system("clear")
|
||||
print(self.compare_hands(0))
|
||||
print(self.compare_hands(float(player_bet)))
|
||||
print(f"Player Chips: {player.chips}")
|
||||
print(f"Dealer Chips: {dealer.chips}")
|
||||
|
||||
# After each full round, the players and dealers hand get
|
||||
# cleared and a new deck is created.
|
||||
|
||||
@@ -7,7 +7,10 @@ if __name__ == "__main__":
|
||||
print("pyjack by cerberus")
|
||||
print("do you wanna play a round??")
|
||||
|
||||
# Create game instance with the player and dealer
|
||||
game = Game()
|
||||
|
||||
# Play the game
|
||||
try:
|
||||
while True:
|
||||
game.play_round()
|
||||
|
||||
Reference in New Issue
Block a user