Skip to content

Commit

Permalink
version 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
thenithinbalaji committed Mar 13, 2022
1 parent 6404a4e commit f871a8d
Show file tree
Hide file tree
Showing 13 changed files with 132 additions and 31 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
__pycache__
__pycache__
todo.txt
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
<h1 align = "center">Rand Toys</h1></center>

<p align = "center">

<img alt="GitHub release (latest by date)" src="https://img.shields.io/github/v/release/thenithinbalaji/pyrandtoys?color=blueviolet">

<img alt="GitHub Release Date" src="https://img.shields.io/github/release-date/thenithinbalaji/pyrandtoys?color=blue">

<img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/thenithinbalaji/pyrandtoys?color=red">

<br>

<img alt="GitHub contributors" src="https://img.shields.io/github/contributors/thenithinbalaji/pyrandtoys?color=ff69b4">

<img alt="GitHub closed issues" src="https://img.shields.io/github/issues-closed/thenithinbalaji/pyrandtoys?color=success">

<img alt="License" src="https://img.shields.io/github/license/thenithinbalaji/pyrandtoys">

<br>
<code> pyrandtoys</code> is a python module containing probability-based toys' functions. <br> It works offline and is compatible with both Python 2 and 3.

</p>

### 🔮 Installation
Expand Down Expand Up @@ -36,6 +53,14 @@ dice(number_of_dice)
coin(number_of_coins)
```

### 🃏 Card
**Optional:** Number of Cards `<int>`
**Default:** Number of Cards = 1
**Return Type:** `<tuple>`
```
card(number_of_cards)
```

### 🧮 Similar Toys

**Optional:** Number of Items `<int>`
Expand Down
11 changes: 11 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ Coin:

coin(number_of_coins)

Card:
^^^^^

+ **Optional:** Number of Cards ``<int>``
+ **Default:** Number of Cards = 1
+ **Return Type:** ``<tuple>``

::

card(number_of_cards)

Similar Toys:
^^^^^^^^^^^^^

Expand Down
1 change: 1 addition & 0 deletions build/lib/pyrandtoys/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
from pyrandtoys.functions import switch
from pyrandtoys.functions import spinner
from pyrandtoys.functions import combi
from pyrandtoys.functions import card
69 changes: 54 additions & 15 deletions build/lib/pyrandtoys/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def dice(count: int = 1) -> Tuple[int, ...]:
Returns:
tuple: The values of dice rolls
Each tuple element is a number between 1 and 6
"""
"""

res = ()

Expand All @@ -24,15 +24,15 @@ def dice(count: int = 1) -> Tuple[int, ...]:

def coin(count: int = 1) -> Tuple[str, ...]:
"""
Rolls N coins
Flips N coins
Parameters:
count (int) : The number of coins to roll, default = 1
count (int) : The number of coins to flip, default = 1
Returns:
tuple: The values of coin rolls
tuple: The values of coin flips
A tuple element can be either HEADS or TAILS
"""
"""

res = ()
sample_space = ["HEADS", "TAILS"]
Expand All @@ -53,7 +53,7 @@ def dreidel(count: int = 1) -> Tuple[str, ...]:
Returns:
tuple: The values of dreidel spins
A tuple element is one of these values: NUN, GIMEL, HE, SHIN
"""
"""

res = ()
sample_space = ["NUN", "GIMEL", "HE", "SHIN"]
Expand All @@ -74,7 +74,7 @@ def cat(count: int = 1) -> Tuple[str, ...]:
Returns:
tuple: The status of cats
A Cat can be ALIVE or DEAD
"""
"""
res = ()
sample_space = ["ALIVE", "DEAD"]

Expand All @@ -86,15 +86,15 @@ def cat(count: int = 1) -> Tuple[str, ...]:

def switch(count: int = 1) -> Tuple[str, ...]:
"""
Flip a switch N times
Toggle a switch N times
Parameters:
count (int) : The number times to flip a switch, default = 1
count (int) : The number times to toggle a switch, default = 1
Returns:
tuple: The status of switches
A Switch can be either ON or OFF
"""
"""
res = ()
sample_space = ["ON", "OFF"]

Expand Down Expand Up @@ -122,6 +122,44 @@ def spinner(lower: int, upper: int = 0) -> int:
return rop.randint(int(lower), int(upper))


def card(count: int = 1) -> Tuple[str, ...]:
"""
Picks N cards from a deck of 52 cards
Parameters:
count (int) : The number of cards to pick, default = 1
Returns:
tuple: The cards that have been picked
Each tuple element is a card from a deck of 52 cards.
"""

SUITS = ("Spades", "Clubs", "Hearts", "Diamonds")
RANKS = (
"Ace",
"Two",
"Three",
"Four",
"Five",
"Six",
"Seven",
"Eight",
"Nine",
"Ten",
"Jack",
"Queen",
"King",
)

sample_space = [rank + " of " + suit for rank in RANKS for suit in SUITS]

res = ()
for _ in range(int(count)):
res += (rop.choice(sample_space),)

return res


def combi(list: list = []) -> Tuple[str, ...]:
"""
Randomise combinations between other functions
Expand All @@ -133,15 +171,13 @@ def combi(list: list = []) -> Tuple[str, ...]:
tuple: The values of the randomised functions
"""
res = ()

if isinstance(list, str):
temp = []
temp.append(list)
list = temp
list = [list]

elif isinstance(list, int):
temp = []
sample_space = ["coin", "dice", "switch"]
sample_space = ["coin", "dice", "switch", "card"]

for _ in range(list):
rand_op = rop.choice(sample_space)
Expand All @@ -167,6 +203,9 @@ def combi(list: list = []) -> Tuple[str, ...]:
elif obj == "switch":
res += switch()

elif obj == "card":
res += card()

else:
res += (None,)

Expand Down
Binary file removed dist/pyrandtoys-0.0.2-py3-none-any.whl
Binary file not shown.
Binary file removed dist/pyrandtoys-0.0.2.tar.gz
Binary file not shown.
Binary file added dist/pyrandtoys-0.1.0-py3-none-any.whl
Binary file not shown.
Binary file added dist/pyrandtoys-0.1.0.tar.gz
Binary file not shown.
13 changes: 12 additions & 1 deletion pyrandtoys.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: pyrandtoys
Version: 0.0.2
Version: 0.1.0
Summary: Python Module for generating the result of probability based toys.
Home-page: https://github.com/thenithinbalaji/pyrandtoys
Author: thenithinbalaji
Expand Down Expand Up @@ -60,6 +60,17 @@ Coin:

coin(number_of_coins)

Card:
^^^^^

+ **Optional:** Number of Cards ``<int>``
+ **Default:** Number of Cards = 1
+ **Return Type:** ``<tuple>``

::

card(number_of_cards)

Similar Toys:
^^^^^^^^^^^^^

Expand Down
1 change: 1 addition & 0 deletions pyrandtoys/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
from pyrandtoys.functions import switch
from pyrandtoys.functions import spinner
from pyrandtoys.functions import combi
from pyrandtoys.functions import card
38 changes: 25 additions & 13 deletions pyrandtoys/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def dice(count: int = 1) -> Tuple[int, ...]:
Returns:
tuple: The values of dice rolls
Each tuple element is a number between 1 and 6
"""
"""

res = ()

Expand All @@ -32,7 +32,7 @@ def coin(count: int = 1) -> Tuple[str, ...]:
Returns:
tuple: The values of coin flips
A tuple element can be either HEADS or TAILS
"""
"""

res = ()
sample_space = ["HEADS", "TAILS"]
Expand All @@ -53,7 +53,7 @@ def dreidel(count: int = 1) -> Tuple[str, ...]:
Returns:
tuple: The values of dreidel spins
A tuple element is one of these values: NUN, GIMEL, HE, SHIN
"""
"""

res = ()
sample_space = ["NUN", "GIMEL", "HE", "SHIN"]
Expand All @@ -74,7 +74,7 @@ def cat(count: int = 1) -> Tuple[str, ...]:
Returns:
tuple: The status of cats
A Cat can be ALIVE or DEAD
"""
"""
res = ()
sample_space = ["ALIVE", "DEAD"]

Expand All @@ -94,7 +94,7 @@ def switch(count: int = 1) -> Tuple[str, ...]:
Returns:
tuple: The status of switches
A Switch can be either ON or OFF
"""
"""
res = ()
sample_space = ["ON", "OFF"]

Expand Down Expand Up @@ -132,10 +132,24 @@ def card(count: int = 1) -> Tuple[str, ...]:
Returns:
tuple: The cards that have been picked
Each tuple element is a card from a deck of 52 cards.
"""
"""

SUITS = ("Spades", "Clubs", "Hearts", "Diamonds")
RANKS = ("Ace", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King")
RANKS = (
"Ace",
"Two",
"Three",
"Four",
"Five",
"Six",
"Seven",
"Eight",
"Nine",
"Ten",
"Jack",
"Queen",
"King",
)

sample_space = [rank + " of " + suit for rank in RANKS for suit in SUITS]

Expand All @@ -157,15 +171,13 @@ def combi(list: list = []) -> Tuple[str, ...]:
tuple: The values of the randomised functions
"""
res = ()

if isinstance(list, str):
temp = []
temp.append(list)
list = temp
list = [list]

elif isinstance(list, int):
temp = []
sample_space = ["coin", "dice", "switch"]
sample_space = ["coin", "dice", "switch", "card"]

for _ in range(list):
rand_op = rop.choice(sample_space)
Expand All @@ -190,7 +202,7 @@ def combi(list: list = []) -> Tuple[str, ...]:

elif obj == "switch":
res += switch()

elif obj == "card":
res += card()

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages

VERSION = "0.0.2"
VERSION = "0.1.0"
DESCRIPTION = "Python Module for generating the result of probability based toys."
LONG_DESC = open("README.rst").read()

Expand Down

0 comments on commit f871a8d

Please sign in to comment.