修改
This commit is contained in:
32
main.py
Normal file
32
main.py
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Poker hand evaluation program
|
||||
Takes 7 cards as string input and outputs the best HandRanking
|
||||
"""
|
||||
|
||||
import sys
|
||||
from poker.hand_evaluator import HandEvaluator
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) != 2:
|
||||
print("Usage: python main.py \"<7 cards>\"")
|
||||
print("Example: python main.py \"AsKs AhAdAc6s7s\"")
|
||||
sys.exit(1)
|
||||
|
||||
cards_str = sys.argv[1]
|
||||
|
||||
try:
|
||||
# 评估手牌
|
||||
hand_ranking = HandEvaluator.evaluate_from_input(cards_str)
|
||||
|
||||
# 输出结果
|
||||
print(hand_ranking)
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user