pyvelepor / poker-hand-analyser Goto Github PK
View Code? Open in Web Editor NEWbased off of rosetta code example
License: MIT License
based off of rosetta code example
License: MIT License
Inside straight
, first
and rest
are two intermediate variables that are intialized but never used. They should be removed.
Currently, the rank
function uses an assert
on the rank
variable to test for successfully finding a match.
Attempted to evaluate "6♥ 3♦ 4♣ 2♣ 5♦", but hand evaluates as high card instead of straight.
Old style of string formatting, which uses %
, is used in several sections of the code. This should be removed and replaced with format
.
For examples: https://pyformat.info/, http://thepythonguru.com/python-string-formatting/
The straight flush function needs to be implemented.
Test: '10♥ j♥ q♥ k♥ a♥'
The example hands under __main__
should be used to create a unit test in test_poker.py
. The test should verify that for each hand, rank
returns the correct rank and tiebraker.
Reference for writing unittests: https://docs.python.org/3/library/unittest.html
This line requires two fixes.
Line 125 in 86bc867
The for loop in rank is using C-style iteration, where an index is manually updated to loop over a sequence. This should be rewritten to use Python-style iteration for looping over a sequence.
Lines 114 to 117 in 86bc867
The flush detection needs to be implemented.
Test: 'q♣ 10♣ 7♣ 6♣ 4♣'
It's not a good practice to use assert statemetns for validating user input. Instead of using assert
, an exception should be raised for invalid poker hands.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.