From eb7bb2f35ec1edfb2ff2d78a1dadf9cc7ad80258 Mon Sep 17 00:00:00 2001 From: Colton Date: Thu, 24 Oct 2019 20:48:28 -0400 Subject: [PATCH 1/3] Converted README file from undesirable rst to beautiful markdown --- README.md | 131 ++++++++++++++++++++++++++++++++++++++++++++++++ README.rst | 144 ----------------------------------------------------- setup.py | 4 +- 3 files changed, 133 insertions(+), 146 deletions(-) create mode 100644 README.md delete mode 100644 README.rst diff --git a/README.md b/README.md new file mode 100644 index 0000000..4f58fb1 --- /dev/null +++ b/README.md @@ -0,0 +1,131 @@ +--- +title: gamble +--- + +[![image](https://travis-ci.org/jpetrucciani/gamble.svg?branch=master)](https://travis-ci.org/jpetrucciani/gamble) + +[![PyPI version](https://badge.fury.io/py/gamble.svg)](https://badge.fury.io/py/gamble) + +[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black) + +[![Python 3.6+ supported](https://img.shields.io/badge/python-3.6+-blue.svg)](https://www.python.org/downloads/release/python-360/) + +[![Documentation style: archives](https://img.shields.io/badge/docstyle-archives-lightblue.svg)](https://github.com/jpetrucciani/archives) + +**gamble** is a simple library that implements a collection of some +common gambling-related classes + +Features +======== + +- die, dice, d-notation +- cards, decks, hands +- poker ranks, hand comparison + +Usage +===== + +Installation +------------ + +``` {.bash} +pip install gamble +``` + +Basic Usage +=========== + +Dice +---- + +``` {.python} +import gamble + +# create dice, defaults to 2 6-sided dice +dice = gamble.Dice() + +# roll +dice.roll() +>>> 6 +dice.rolls +>>> 1 + +# max, min +dice.max +>>> 12 +dice.min +>>> 2 + +# d-notation for dice constructor +dice = gamble.Dice('d20+8') + +# max, min +dice.max +>>> 28 +dice.min +>>> 9 + +# parts +dice.parts +>>> [, 8] + +# roll_many +dice.roll_many(2) +>>> [8, 4] + +# max_of, min_of +dice.max_of(3) +>>> (11, [7, 3, 11]) +dice.min_of(3) +>>> (2, [2, 9, 4]) +``` + +Cards +----- + +``` {.python} +import gamble + +# create a deck, defaults to the standard 52 card deck, no jokers +# the deck will be shuffled by default, unless you pass shuffle=False +deck = gamble.Deck() + +deck.cards_left +>>> 52 + +deck.top +>>> +deck.bottom +>>> +deck.shuffle() # you can also pass times=(int) to shuffle more than once + +card = deck.draw() # you can also pass times=(int) to draw a list of cards +>>> + +# the unicode cards icons are implemented as well! +card.unicode +>>> "🂡" + +# draw a poker hand, default size 5 +hand = deck.draw_hand(). # you can pass size=(int) to draw a different size hand +>>> + +hand.rank +>>> Rank(name='straight flush', value=8) + +# arbitrary hand, from text notation +new_hand = gamble.Hand.get("2c,3c,4c,Kc,Kh") +>>> + +new_hand.rank +>>> Rank(name='pair', value=1) + +hand > new_hand +>>> True +``` + +Todo +==== + +- hand equals/ge/le method +- hand ranking when hands are very similar diff --git a/README.rst b/README.rst deleted file mode 100644 index d5a3354..0000000 --- a/README.rst +++ /dev/null @@ -1,144 +0,0 @@ -gamble -============================================== - -.. image:: https://travis-ci.org/jpetrucciani/gamble.svg?branch=master - :target: https://travis-ci.org/jpetrucciani/gamble - - -.. image:: https://badge.fury.io/py/gamble.svg - :target: https://badge.fury.io/py/gamble - :alt: PyPI version - - -.. image:: https://img.shields.io/badge/code%20style-black-000000.svg - :target: https://github.com/ambv/black - :alt: Code style: black - - -.. image:: https://img.shields.io/badge/python-3.6+-blue.svg - :target: https://www.python.org/downloads/release/python-360/ - :alt: Python 3.6+ supported - - -.. image:: https://img.shields.io/badge/docstyle-archives-lightblue.svg - :target: https://github.com/jpetrucciani/archives - :alt: Documentation style: archives - - -**gamble** is a simple library that implements a collection of some common gambling-related classes - - -Features --------- - -- die, dice, d-notation -- cards, decks, hands -- poker ranks, hand comparison - -Usage ------ - -Installation -^^^^^^^^^^^^ - -.. code-block:: bash - - pip install gamble - -Basic Usage ------------ - -Dice -^^^^ - -.. code-block:: python - - import gamble - - # create dice, defaults to 2 6-sided dice - dice = gamble.Dice() - - # roll - dice.roll() - >>> 6 - dice.rolls - >>> 1 - - # max, min - dice.max - >>> 12 - dice.min - >>> 2 - - # d-notation for dice constructor - dice = gamble.Dice('d20+8') - - # max, min - dice.max - >>> 28 - dice.min - >>> 9 - - # parts - dice.parts - >>> [, 8] - - # roll_many - dice.roll_many(2) - >>> [8, 4] - - # max_of, min_of - dice.max_of(3) - >>> (11, [7, 3, 11]) - dice.min_of(3) - >>> (2, [2, 9, 4]) - - -Cards -^^^^^ - -.. code-block:: python - - import gamble - - # create a deck, defaults to the standard 52 card deck, no jokers - # the deck will be shuffled by default, unless you pass shuffle=False - deck = gamble.Deck() - - deck.cards_left - >>> 52 - - deck.top - >>> - deck.bottom - >>> - deck.shuffle() # you can also pass times=(int) to shuffle more than once - - card = deck.draw() # you can also pass times=(int) to draw a list of cards - >>> - - # the unicode cards icons are implemented as well! - card.unicode - >>> "🂡" - - # draw a poker hand, default size 5 - hand = deck.draw_hand(). # you can pass size=(int) to draw a different size hand - >>> - - hand.rank - >>> Rank(name='straight flush', value=8) - - # arbitrary hand, from text notation - new_hand = gamble.Hand.get("2c,3c,4c,Kc,Kh") - >>> - - new_hand.rank - >>> Rank(name='pair', value=1) - - hand > new_hand - >>> True - -Todo ----- -- hand equals/ge/le method -- hand ranking when hands are very similar diff --git a/setup.py b/setup.py index 82b4c61..c186194 100755 --- a/setup.py +++ b/setup.py @@ -9,15 +9,15 @@ __library__ = "gamble" __version__ = "0.7" -with open("README.rst") as readme: +with open("README.md") as readme: LONG_DESCRIPTION = readme.read() - setup( name=__library__, version=__version__, description=("a collection of gambling classes/tools"), long_description=LONG_DESCRIPTION, + long_description_content_type="text/markdown", author="Jacobi Petrucciani", author_email="jacobi@mimirhq.com", url="https://github.com/jpetrucciani/{}.git".format(__library__), From 199eed582f0b4f32d1fc22b47cfe7a2a1cb10683 Mon Sep 17 00:00:00 2001 From: Colton Date: Thu, 24 Oct 2019 21:10:13 -0400 Subject: [PATCH 2/3] Fixed formatting of README --- README.md | 41 +++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 4f58fb1..83ad1ad 100644 --- a/README.md +++ b/README.md @@ -3,42 +3,33 @@ title: gamble --- [![image](https://travis-ci.org/jpetrucciani/gamble.svg?branch=master)](https://travis-ci.org/jpetrucciani/gamble) - [![PyPI version](https://badge.fury.io/py/gamble.svg)](https://badge.fury.io/py/gamble) - [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black) - [![Python 3.6+ supported](https://img.shields.io/badge/python-3.6+-blue.svg)](https://www.python.org/downloads/release/python-360/) - [![Documentation style: archives](https://img.shields.io/badge/docstyle-archives-lightblue.svg)](https://github.com/jpetrucciani/archives) **gamble** is a simple library that implements a collection of some common gambling-related classes -Features -======== +# Features -- die, dice, d-notation -- cards, decks, hands -- poker ranks, hand comparison +- die, dice, d-notation +- cards, decks, hands +- poker ranks, hand comparison -Usage -===== +# Usage -Installation ------------- +## Installation -``` {.bash} +```{.bash} pip install gamble ``` -Basic Usage -=========== +# Basic Usage -Dice ----- +## Dice -``` {.python} +```{.python} import gamble # create dice, defaults to 2 6-sided dice @@ -80,10 +71,9 @@ dice.min_of(3) >>> (2, [2, 9, 4]) ``` -Cards ------ +## Cards -``` {.python} +```{.python} import gamble # create a deck, defaults to the standard 52 card deck, no jokers @@ -124,8 +114,7 @@ hand > new_hand >>> True ``` -Todo -==== +# Todo -- hand equals/ge/le method -- hand ranking when hands are very similar +- hand equals/ge/le method +- hand ranking when hands are very similar From ba8c536f67518b2921e9129f3a4a1326a805719f Mon Sep 17 00:00:00 2001 From: Colton Date: Thu, 24 Oct 2019 21:12:05 -0400 Subject: [PATCH 3/3] Fixed formatting of README --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 83ad1ad..b6744d3 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ ---- -title: gamble ---- - [![image](https://travis-ci.org/jpetrucciani/gamble.svg?branch=master)](https://travis-ci.org/jpetrucciani/gamble) -[![PyPI version](https://badge.fury.io/py/gamble.svg)](https://badge.fury.io/py/gamble) -[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black) -[![Python 3.6+ supported](https://img.shields.io/badge/python-3.6+-blue.svg)](https://www.python.org/downloads/release/python-360/) -[![Documentation style: archives](https://img.shields.io/badge/docstyle-archives-lightblue.svg)](https://github.com/jpetrucciani/archives) +[![PyPI +version](https://badge.fury.io/py/gamble.svg)](https://badge.fury.io/py/gamble) +[![Code style: +black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black) +[![Python 3.6+ +supported](https://img.shields.io/badge/python-3.6+-blue.svg)](https://www.python.org/downloads/release/python-360/) +[![Documentation style: +archives](https://img.shields.io/badge/docstyle-archives-lightblue.svg)](https://github.com/jpetrucciani/archives) **gamble** is a simple library that implements a collection of some common gambling-related classes @@ -21,7 +21,7 @@ common gambling-related classes ## Installation -```{.bash} +```bash pip install gamble ``` @@ -29,7 +29,7 @@ pip install gamble ## Dice -```{.python} +```python import gamble # create dice, defaults to 2 6-sided dice @@ -73,7 +73,7 @@ dice.min_of(3) ## Cards -```{.python} +```python import gamble # create a deck, defaults to the standard 52 card deck, no jokers