Skip to content

Commit

Permalink
Do more code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Gongsta committed Jun 14, 2024
1 parent 10d3df3 commit 8757ad1
Show file tree
Hide file tree
Showing 8 changed files with 1,809 additions and 1,675 deletions.
796 changes: 411 additions & 385 deletions src/environment.py

Large diffs are not rendered by default.

1,136 changes: 603 additions & 533 deletions src/evaluator.py

Large diffs are not rendered by default.

35 changes: 18 additions & 17 deletions src/fast_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,26 @@
This is a fast evaluator used for training. It works with string representation of
cards. However, it cannot tell you if you won with a pair, three of a kind, etc.
"""
import random

import random
from phevaluator import evaluate_cards


def Deck(excluded_cards=[]):
# Returns a shuffled deck
deck = []
for rank in ["A", "2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K"]:
for suit in ["h", "d", "s", "c"]:
if (rank+suit not in excluded_cards):
deck.append(rank + suit)

random.shuffle(deck)
return deck
# Returns a shuffled deck
deck = []
for rank in ["A", "2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K"]:
for suit in ["h", "d", "s", "c"]:
if rank + suit not in excluded_cards:
deck.append(rank + suit)

random.shuffle(deck)
return deck


def get_player_score(player_cards, board=[]):
"""Wrapper for the evaluate_cards function by phevaluator.
"""
assert(len(player_cards) == 2)
assert(len(board) <= 5)
# Returns a score using the phevaluator library
return evaluate_cards(*(player_cards + board))
"""Wrapper for the evaluate_cards function by phevaluator."""
assert len(player_cards) == 2
assert len(board) <= 5
# Returns a score using the phevaluator library
return evaluate_cards(*(player_cards + board))
Loading

0 comments on commit 8757ad1

Please sign in to comment.