From 63a212c4fd67eef33d7db9fe0d6d00ec292917a1 Mon Sep 17 00:00:00 2001 From: Pythonun <45327855+Pythonun@users.noreply.github.com> Date: Sun, 25 Nov 2018 20:22:47 +0800 Subject: [PATCH 1/4] Initial commit --- .gitignore | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..894a44c --- /dev/null +++ b/.gitignore @@ -0,0 +1,104 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ From 2bafcb326528fe333636e7e68da99ebb93299689 Mon Sep 17 00:00:00 2001 From: Pythonun <45327855+Pythonun@users.noreply.github.com> Date: Sun, 25 Nov 2018 20:35:00 +0800 Subject: [PATCH 2/4] Create bos.py --- bos.py | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 bos.py diff --git a/bos.py b/bos.py new file mode 100644 index 0000000..b2c6702 --- /dev/null +++ b/bos.py @@ -0,0 +1,2 @@ +import random +def roll_dice(numbers = 3,points = None): From 9cff97c0f22f139d1230b9f4b73dc105e61adeb1 Mon Sep 17 00:00:00 2001 From: Pythonun <45327855+Pythonun@users.noreply.github.com> Date: Sun, 25 Nov 2018 21:14:48 +0800 Subject: [PATCH 3/4] Update bos.py --- bos.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bos.py b/bos.py index b2c6702..fb8306c 100644 --- a/bos.py +++ b/bos.py @@ -1,2 +1,5 @@ import random def roll_dice(numbers = 3,points = None): + print('<<<<<<< ROLL THE DICE >>>>>>>>') + if points is None: + point From a9a5f34f5314976fea74cbc61b6fee2e98b364e1 Mon Sep 17 00:00:00 2001 From: Pythonun <45327855+Pythonun@users.noreply.github.com> Date: Sun, 3 Mar 2019 16:19:03 +0800 Subject: [PATCH 4/4] Update bos.py --- bos.py | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/bos.py b/bos.py index fb8306c..bbca436 100644 --- a/bos.py +++ b/bos.py @@ -2,4 +2,40 @@ def roll_dice(numbers = 3,points = None): print('<<<<<<< ROLL THE DICE >>>>>>>>') if points is None: - point + point = [] + while numbers > 0: + point = random.randrange(1,7) + points.append(point) + numbers = numbers - 1 + return points + +def roll_result(total): + isBig = 11 < total < 18 + isSmall = 3 < total < 10 + if isBig: + return 'Big' + elif isSmall: + return 'Small' + +def start_game(): + your_money = 1000 + while your_money > 0: + print('<<<<<<< GAME STARTS! >>>>>>>') + choices = ['Big','Small'] + your_choice = input('Big or Samll:') + if your_choice in choices: + your_bet = int(input('how much you wanna bet? - ')) + points = roll_dice() + total = sum(points) + youwin = your_choice == roll_result(total) + if youwin: + print('The points is',points,'youwin!') + print('you gained {},you have {} now'.format(your_bet,your_money + your_bet)) + else: + print('The points is',points,'youlose!') + print('you lost {},you have {} now'.format(your_bet,your_money - your_bet)) + your_money = your_money - your_bet + else: + print('Invalid words') + else: + print('GAME OVER')