Skip to content

Commit 769a0a7

Browse files
authored
1.2.0 (#2)
1 parent bee4967 commit 769a0a7

File tree

12 files changed

+215
-77
lines changed

12 files changed

+215
-77
lines changed

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM python:3.8-alpine
2+
3+
RUN apk add --no-cache musl-dev libffi-dev gcc
4+
5+
ARG TEST_PYPI_USERNAME
6+
ARG TEST_PYPI_PASSWORD
7+
8+
RUN mkdir /slots
9+
10+
WORKDIR /slots
11+
12+
COPY . .
13+
14+
RUN python3 -m pip install --upgrade build
15+
RUN python3 -m build
16+
17+
RUN python3 -m pip install --upgrade twine
18+
RUN python3 -m twine upload -u $TEST_PYPI_USERNAME -p $TEST_PYPI_PASSWORD --repository testpypi dist/*

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Lukas Batema
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

MANIFEST.in

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
include *.py
2-
include */*.py
3-
include */*/*.py
2+
include */*.py

PYSlots/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION="1.0.696"
1+
VERSION = "1.2.0"

PYSlots/__main__.py

Lines changed: 95 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,100 @@
11
import random as rand
2+
import sys, os
3+
from . import __init__ as __init__
4+
from .args import parse_args
5+
from .update import update
6+
27

38
def main():
4-
currentMoney = 1000
5-
timesLooped = 0
6-
userInput = "Press \"Y\" to continue, or press anything else to end:"
7-
stoppingMsg = "Stopping..."
8-
dividerMsg = "=========="
9-
slotsMessage = "Slot Numbers"
10-
11-
print(dividerMsg)
12-
print(slotsMessage)
13-
print(dividerMsg)
14-
15-
while currentMoney > 0:
16-
if timesLooped >= 1:
17-
print(userInput)
18-
print(dividerMsg)
19-
userAnswer = input()
20-
21-
if userAnswer == "y" or userAnswer == "Y" or userAnswer == "yes" or userAnswer == "Yes":
22-
print(dividerMsg)
23-
print(slotsMessage)
24-
print(dividerMsg)
25-
else:
26-
print(stoppingMsg)
27-
print(dividerMsg)
28-
break
29-
30-
slotOne = rand.randint(1,6)
31-
print(slotOne)
32-
33-
slotTwo = rand.randint(1,6)
34-
print(slotTwo)
35-
36-
slotThree = rand.randint(1,6)
37-
print(slotThree)
38-
39-
print(dividerMsg)
40-
moneyGambled = rand.randrange(100,500,100)
41-
42-
if slotOne == slotTwo == slotThree:
43-
currentMoney += moneyGambled
44-
print("$" + str(currentMoney) + ".00")
45-
print(dividerMsg)
9+
args = parse_args()
10+
11+
if args.update:
12+
print("This feature currently does not work. Please use 'pip install --upgrade pyslots', to update.")
13+
sys.exit(0)
14+
# update()
15+
if args.version:
16+
print("This feature currently does not work! Check back later.")
17+
# print("PYSlots Version:", __init__.VERSION)
18+
sys.exit(0)
4619
else:
47-
currentMoney -= moneyGambled
48-
if currentMoney < 0:
49-
currentMoney = 0
50-
51-
print("$" + str(currentMoney) + ".00")
52-
53-
print(dividerMsg)
54-
print(stoppingMsg)
55-
print(dividerMsg)
56-
57-
break
58-
elif currentMoney == 0:
59-
print("$" + str(currentMoney) + ".00")
60-
61-
print(dividerMsg)
62-
print(stoppingMsg)
63-
print(dividerMsg)
64-
break
65-
else:
66-
print("$" + str(currentMoney) + ".00")
67-
print(dividerMsg)
68-
timesLooped += 1
69-
20+
current_money = 1000
21+
times_looped = 0
22+
user_input = "Press \"Y\" to continue, or press anything else to end:"
23+
stopping_msg = "Stopping..."
24+
divider_msg = "=========="
25+
slots_msg = "Slot Numbers"
26+
27+
print(divider_msg)
28+
print(slots_msg)
29+
print(divider_msg)
30+
31+
while current_money > 0:
32+
if times_looped >= 1:
33+
print(user_input)
34+
print(divider_msg)
35+
user_ans = input()
36+
37+
if user_ans == "y" or user_ans == "Y" or user_ans == "yes" or user_ans == "Yes":
38+
print(divider_msg)
39+
print(slots_msg)
40+
print(divider_msg)
41+
else:
42+
print(stopping_msg)
43+
print(divider_msg)
44+
break
45+
46+
slot_one = rand.randint(1, 6)
47+
print(slot_one)
48+
49+
slot_two = rand.randint(1, 6)
50+
print(slot_two)
51+
52+
slot_three = rand.randint(1, 6)
53+
print(slot_three)
54+
55+
print(divider_msg)
56+
money_gambled = rand.randrange(100, 500, 1)
57+
58+
if slot_one == slot_two == slot_three:
59+
current_money += round(money_gambled, None)
60+
print("$" + str(current_money) + ".00")
61+
print(divider_msg)
62+
elif slot_one == slot_two or slot_two == slot_three:
63+
current_money += round(money_gambled / 4, None)
64+
print("$" + str(current_money) + ".00")
65+
print(divider_msg)
66+
elif slot_one == slot_three:
67+
current_money += round(money_gambled / 16, None)
68+
print("$" + str(current_money) + ".00")
69+
print(divider_msg)
70+
elif slot_one != slot_two != slot_three:
71+
current_money -= money_gambled
72+
if current_money < 0:
73+
current_money = 0
74+
75+
print("$" + str(current_money) + ".00")
76+
77+
print(divider_msg)
78+
print(stopping_msg)
79+
print(divider_msg)
80+
81+
break
82+
elif current_money == 0:
83+
print("$" + str(current_money) + ".00")
84+
85+
print(divider_msg)
86+
print(stopping_msg)
87+
print(divider_msg)
88+
break
89+
else:
90+
print("$" + str(current_money) + ".00")
91+
print(divider_msg)
92+
times_looped += 1
93+
try:
94+
if args.help:
95+
sys.exit(0)
96+
except AttributeError:
97+
pass
98+
7099
if __name__ == "__main__":
71-
main()
100+
main()

PYSlots/args.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import argparse
2+
3+
def parse_args():
4+
parser = argparse.ArgumentParser(
5+
description="PYSlots\n" "https://github.com/Lukas-Batema/pyslots"
6+
)
7+
parser.add_argument(
8+
"--mcrefvers",
9+
action="store_true",
10+
help="Use the \"Don't look directly at the bugs\" version (Obviously a Minceraft reference...)",
11+
)
12+
parser.add_argument(
13+
"--update",
14+
"-u",
15+
action="store_true",
16+
help="Update to the latest stable version",
17+
)
18+
parser.add_argument(
19+
"--version",
20+
"-v",
21+
action="store_true",
22+
help="Print the PYSlots version",
23+
)
24+
25+
return parser.parse_args()

PYSlots/resources/__init.py__

Whitespace-only changes.

PYSlots/resources/pyslots_ids.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"map": {
3+
"PYSlots Version:": "pyslots_version"
4+
},
5+
"pyslots_version": {
6+
"1.2.0": "1.2.0b",
7+
"1.1.1": "old-1.1.1"
8+
}
9+
}

PYSlots/update.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import urllib.request, sys, os
2+
from .args import parse_args
3+
4+
args = parse_args()
5+
6+
def update():
7+
try:
8+
# print("Checking for newer versions, then updating if any...")
9+
url = f"https://raw.githubusercontent.com/Lukas-Batema/pyslots/{'1.2.0' if args.mcrefvers else 'master'}/PYSlots/resources/pyslots_ids.json"
10+
urllib.request.urlretrieve(
11+
url, os.path.dirname(__file__) + "/resources/pyslots.json"
12+
)
13+
sys.exit(0)
14+
except:
15+
pass

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
11
# PYSlots
2+
<p align="center">
3+
<a href="https://img.shields.io/badge/Compatible-MacOS%2FWindows%2FLinux-brightgreen?style=for-the-badge&logo=discord">
4+
<img src="https://img.shields.io/badge/Compatible-MacOS%2FLinux%2FWindows%2F-brightgreen?style=for-the-badge&logo=checkmarx&logoColor=white">
5+
</a>
6+
7+
<a href="https://www.python.org/downloads/">
8+
<img src="https://img.shields.io/pypi/pyversions/django?color=dark%20green&logo=python&logoColor=white&style=for-the-badge">
9+
</a>
10+
</p>
11+
12+
## PyPI and Test PyPI External Links
13+
[PyPI](https://pypi.org/project/PYSlots/)
14+
15+
[Test PyPI](https://test.pypi.org/project/PYSlots/)
216
## Install
17+
### Look directly at the bugs! Version
318
`pip install pyslots`
419

20+
### "Don't look directly at the bugs!" Version
21+
`pip install -i https://test.pypi.org/simple/ PYSlots`
522
## Run
6-
`pyslots`
23+
`pyslots` and if that does not work, do: `python3 -m PYSlots` (Yes, it is case-sensitive).
24+
25+
## Arguments
26+
`--mcrefvers`: *Use the "Don't look directly at the bugs" version (Obviously a Minceraft reference...)*
27+
28+
`--update`: *Update to the latest stable version*
29+
30+
`--version`, `-v`: *Print the PYSlots version*
31+
32+
## Hosted on...
33+
*Use my referral code: [BatemaDevelopment](https://railway.app?referralCode=BatemaDevelopment), on [Railway](https://railway.app/)!*

0 commit comments

Comments
 (0)