mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 01:09:40 +08:00
Dijkstra algorithm with binary grid (#8802)
* Create TestShiva * Delete TestShiva * Implementation of the Dijkstra-Algorithm in a binary grid * Update double_ended_queue.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update least_common_multiple.py * Update sol1.py * Update pyproject.toml * Update pyproject.toml * https://github.com/astral-sh/ruff-pre-commit v0.0.274 --------- Co-authored-by: ShivaDahal99 <130563462+ShivaDahal99@users.noreply.github.com> Co-authored-by: jlhuhn <134317018+jlhuhn@users.noreply.github.com> Co-authored-by: Christian Clauss <cclauss@me.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -47,18 +47,18 @@ import os
|
||||
|
||||
class PokerHand:
|
||||
"""Create an object representing a Poker Hand based on an input of a
|
||||
string which represents the best 5 card combination from the player's hand
|
||||
string which represents the best 5-card combination from the player's hand
|
||||
and board cards.
|
||||
|
||||
Attributes: (read-only)
|
||||
hand: string representing the hand consisting of five cards
|
||||
hand: a string representing the hand consisting of five cards
|
||||
|
||||
Methods:
|
||||
compare_with(opponent): takes in player's hand (self) and
|
||||
opponent's hand (opponent) and compares both hands according to
|
||||
the rules of Texas Hold'em.
|
||||
Returns one of 3 strings (Win, Loss, Tie) based on whether
|
||||
player's hand is better than opponent's hand.
|
||||
player's hand is better than the opponent's hand.
|
||||
|
||||
hand_name(): Returns a string made up of two parts: hand name
|
||||
and high card.
|
||||
@ -66,11 +66,11 @@ class PokerHand:
|
||||
Supported operators:
|
||||
Rich comparison operators: <, >, <=, >=, ==, !=
|
||||
|
||||
Supported builtin methods and functions:
|
||||
Supported built-in methods and functions:
|
||||
list.sort(), sorted()
|
||||
"""
|
||||
|
||||
_HAND_NAME = [
|
||||
_HAND_NAME = (
|
||||
"High card",
|
||||
"One pair",
|
||||
"Two pairs",
|
||||
@ -81,10 +81,10 @@ class PokerHand:
|
||||
"Four of a kind",
|
||||
"Straight flush",
|
||||
"Royal flush",
|
||||
]
|
||||
)
|
||||
|
||||
_CARD_NAME = [
|
||||
"", # placeholder as lists are zero indexed
|
||||
_CARD_NAME = (
|
||||
"", # placeholder as tuples are zero-indexed
|
||||
"One",
|
||||
"Two",
|
||||
"Three",
|
||||
@ -99,7 +99,7 @@ class PokerHand:
|
||||
"Queen",
|
||||
"King",
|
||||
"Ace",
|
||||
]
|
||||
)
|
||||
|
||||
def __init__(self, hand: str) -> None:
|
||||
"""
|
||||
|
Reference in New Issue
Block a user