Skip to content

Commit

Permalink
Something
Browse files Browse the repository at this point in the history
  • Loading branch information
workonfire committed May 11, 2021
1 parent 8dd37aa commit cfa7340
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ archlinux_dist:

benchmark:
time echo -e "computer_1\ncomputer_2\n1000\ny\n" | python -m uno --debug --cheats

benchmark_slow:
time echo -e "computer_1\ncomputer_2\n5000\ny\n" | python -m uno --debug --cheats
1 change: 1 addition & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ What to implement:
- A menu
- Auto-save system
- Aliases like `4B`, `*` and auto-correction like `4lbue` -> `4 BLUE`
- Remove the infinite deck system... there is a FINITE amount of +4's, +2's etc...

Developer notes:
- Optimize `list()/[*]` and `set()`
7 changes: 6 additions & 1 deletion uno/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,12 @@ def play(self, card: Card, player: Player, stacking: bool = False):
print(f"{self.turn.name} changed the color to {new_color}")
else:
# TODO: Language file
new_color = CardColor[input("Please input a new card color: ").upper()]
while True:
try:
new_color = CardColor[input("New card color: ").upper()]
break
except KeyError:
print(Fore.RED + "Incorrect input. Please type a card color, e.g. \"GREEN\"" + Fore.RESET)
if card.card_type == CardType.CARD_PLUS_4:
new_cards: List[Card] = self.deck.draw(4)
for new_card in new_cards:
Expand Down
5 changes: 1 addition & 4 deletions uno/tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,13 @@ def test_drawing(self): # TODO

def test_deck(self):
deck: Deck = Deck()
old_card: Card = deck.stack
deck.draw(10)
new_card: Card = deck.stack
self.assertNotEqual(old_card, new_card)
self.assertEqual(len(deck.draw(100)), 100)

def test_player(self):
player: Player = Player()
self.assertEqual(player.name, None)
self.assertEqual(player.hand, [], "The player's hand is empty.")
self.assertEqual(player.hand, [])

def test_player_deal(self):
player: Player = Player("Test")
Expand Down

0 comments on commit cfa7340

Please sign in to comment.