diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..eaf91e2 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/PyLadder.iml b/.idea/PyLadder.iml new file mode 100644 index 0000000..2946dc0 --- /dev/null +++ b/.idea/PyLadder.iml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..5ccec97 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,19 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..8d93904 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..a7fb24e --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..9661ac7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/pyladder/assets/1.jpg b/pyladder/assets/1.jpg new file mode 100644 index 0000000..6e246f0 Binary files /dev/null and b/pyladder/assets/1.jpg differ diff --git a/pyladder/assets/2.jpg b/pyladder/assets/2.jpg new file mode 100644 index 0000000..8c4cbea Binary files /dev/null and b/pyladder/assets/2.jpg differ diff --git a/pyladder/assets/3.jpg b/pyladder/assets/3.jpg new file mode 100644 index 0000000..6e246f0 Binary files /dev/null and b/pyladder/assets/3.jpg differ diff --git a/pyladder/assets/ASAC.png b/pyladder/assets/ASAC.png new file mode 100644 index 0000000..c4086e6 Binary files /dev/null and b/pyladder/assets/ASAC.png differ diff --git a/pyladder/assets/Snakes_ladders_big_image.png b/pyladder/assets/Snakes_ladders_big_image.png new file mode 100644 index 0000000..9b38422 Binary files /dev/null and b/pyladder/assets/Snakes_ladders_big_image.png differ diff --git a/pyladder/assets/bg_menu.jpg b/pyladder/assets/bg_menu.jpg new file mode 100644 index 0000000..3e8e437 Binary files /dev/null and b/pyladder/assets/bg_menu.jpg differ diff --git a/pyladder/assets/blue.png b/pyladder/assets/blue.png new file mode 100644 index 0000000..e87f4ba Binary files /dev/null and b/pyladder/assets/blue.png differ diff --git a/pyladder/assets/dice_image1.png b/pyladder/assets/dice_image1.png new file mode 100644 index 0000000..ff343f2 Binary files /dev/null and b/pyladder/assets/dice_image1.png differ diff --git a/pyladder/assets/dice_image2.png b/pyladder/assets/dice_image2.png new file mode 100644 index 0000000..f40f94b Binary files /dev/null and b/pyladder/assets/dice_image2.png differ diff --git a/pyladder/assets/dice_image3.png b/pyladder/assets/dice_image3.png new file mode 100644 index 0000000..e7fdfe2 Binary files /dev/null and b/pyladder/assets/dice_image3.png differ diff --git a/pyladder/assets/dice_image4.png b/pyladder/assets/dice_image4.png new file mode 100644 index 0000000..6e7fd88 Binary files /dev/null and b/pyladder/assets/dice_image4.png differ diff --git a/pyladder/assets/dice_image5.png b/pyladder/assets/dice_image5.png new file mode 100644 index 0000000..c6d2799 Binary files /dev/null and b/pyladder/assets/dice_image5.png differ diff --git a/pyladder/assets/dice_image6.png b/pyladder/assets/dice_image6.png new file mode 100644 index 0000000..d06efb7 Binary files /dev/null and b/pyladder/assets/dice_image6.png differ diff --git a/pyladder/assets/extra.jpg b/pyladder/assets/extra.jpg new file mode 100644 index 0000000..6495df3 Binary files /dev/null and b/pyladder/assets/extra.jpg differ diff --git a/pyladder/assets/game_background.jpg b/pyladder/assets/game_background.jpg new file mode 100644 index 0000000..9fdd4f3 Binary files /dev/null and b/pyladder/assets/game_background.jpg differ diff --git a/pyladder/assets/icon.jpg b/pyladder/assets/icon.jpg new file mode 100644 index 0000000..4a6746b Binary files /dev/null and b/pyladder/assets/icon.jpg differ diff --git a/pyladder/assets/introduction_image.png b/pyladder/assets/introduction_image.png new file mode 100644 index 0000000..a7f60f1 Binary files /dev/null and b/pyladder/assets/introduction_image.png differ diff --git a/pyladder/assets/introduction_image2.png b/pyladder/assets/introduction_image2.png new file mode 100644 index 0000000..04a0f4c Binary files /dev/null and b/pyladder/assets/introduction_image2.png differ diff --git a/pyladder/assets/introduction_image3.png b/pyladder/assets/introduction_image3.png new file mode 100644 index 0000000..128cc8f Binary files /dev/null and b/pyladder/assets/introduction_image3.png differ diff --git a/pyladder/assets/introduction_image4.png b/pyladder/assets/introduction_image4.png new file mode 100644 index 0000000..e4fd9b8 Binary files /dev/null and b/pyladder/assets/introduction_image4.png differ diff --git a/pyladder/assets/introduction_image5.png b/pyladder/assets/introduction_image5.png new file mode 100644 index 0000000..a7d98bb Binary files /dev/null and b/pyladder/assets/introduction_image5.png differ diff --git a/pyladder/assets/loss_computer.png b/pyladder/assets/loss_computer.png new file mode 100644 index 0000000..bbb29f9 Binary files /dev/null and b/pyladder/assets/loss_computer.png differ diff --git a/pyladder/assets/loss_player.png b/pyladder/assets/loss_player.png new file mode 100644 index 0000000..ddacfa1 Binary files /dev/null and b/pyladder/assets/loss_player.png differ diff --git a/pyladder/assets/man.png b/pyladder/assets/man.png new file mode 100644 index 0000000..18b24d1 Binary files /dev/null and b/pyladder/assets/man.png differ diff --git a/pyladder/assets/menu.jpg b/pyladder/assets/menu.jpg new file mode 100644 index 0000000..3c6c2e8 Binary files /dev/null and b/pyladder/assets/menu.jpg differ diff --git a/pyladder/assets/question/q1.jpg b/pyladder/assets/question/q1.jpg new file mode 100644 index 0000000..2902bf8 Binary files /dev/null and b/pyladder/assets/question/q1.jpg differ diff --git a/pyladder/assets/question/q10.jpg b/pyladder/assets/question/q10.jpg new file mode 100644 index 0000000..b7d7308 Binary files /dev/null and b/pyladder/assets/question/q10.jpg differ diff --git a/pyladder/assets/question/q11.jpg b/pyladder/assets/question/q11.jpg new file mode 100644 index 0000000..90e06c9 Binary files /dev/null and b/pyladder/assets/question/q11.jpg differ diff --git a/pyladder/assets/question/q12.jpg b/pyladder/assets/question/q12.jpg new file mode 100644 index 0000000..d00eaea Binary files /dev/null and b/pyladder/assets/question/q12.jpg differ diff --git a/pyladder/assets/question/q13.jpg b/pyladder/assets/question/q13.jpg new file mode 100644 index 0000000..d4429a6 Binary files /dev/null and b/pyladder/assets/question/q13.jpg differ diff --git a/pyladder/assets/question/q14.jpg b/pyladder/assets/question/q14.jpg new file mode 100644 index 0000000..fcb2f18 Binary files /dev/null and b/pyladder/assets/question/q14.jpg differ diff --git a/pyladder/assets/question/q15.jpg b/pyladder/assets/question/q15.jpg new file mode 100644 index 0000000..6b89a28 Binary files /dev/null and b/pyladder/assets/question/q15.jpg differ diff --git a/pyladder/assets/question/q16.jpg b/pyladder/assets/question/q16.jpg new file mode 100644 index 0000000..658d572 Binary files /dev/null and b/pyladder/assets/question/q16.jpg differ diff --git a/pyladder/assets/question/q17.jpg b/pyladder/assets/question/q17.jpg new file mode 100644 index 0000000..fabe723 Binary files /dev/null and b/pyladder/assets/question/q17.jpg differ diff --git a/pyladder/assets/question/q2.jpg b/pyladder/assets/question/q2.jpg new file mode 100644 index 0000000..7c6dca6 Binary files /dev/null and b/pyladder/assets/question/q2.jpg differ diff --git a/pyladder/assets/question/q3.jpg b/pyladder/assets/question/q3.jpg new file mode 100644 index 0000000..25cfe40 Binary files /dev/null and b/pyladder/assets/question/q3.jpg differ diff --git a/pyladder/assets/question/q4.png b/pyladder/assets/question/q4.png new file mode 100644 index 0000000..1126435 Binary files /dev/null and b/pyladder/assets/question/q4.png differ diff --git a/pyladder/assets/question/q5.jpg b/pyladder/assets/question/q5.jpg new file mode 100644 index 0000000..e7a4b09 Binary files /dev/null and b/pyladder/assets/question/q5.jpg differ diff --git a/pyladder/assets/question/q6.png b/pyladder/assets/question/q6.png new file mode 100644 index 0000000..f24ec7f Binary files /dev/null and b/pyladder/assets/question/q6.png differ diff --git a/pyladder/assets/question/q7.png b/pyladder/assets/question/q7.png new file mode 100644 index 0000000..ac336e1 Binary files /dev/null and b/pyladder/assets/question/q7.png differ diff --git a/pyladder/assets/question/q8.jpg b/pyladder/assets/question/q8.jpg new file mode 100644 index 0000000..e1a11aa Binary files /dev/null and b/pyladder/assets/question/q8.jpg differ diff --git a/pyladder/assets/question/q9.jpg b/pyladder/assets/question/q9.jpg new file mode 100644 index 0000000..00a28e3 Binary files /dev/null and b/pyladder/assets/question/q9.jpg differ diff --git a/pyladder/assets/r1.png b/pyladder/assets/r1.png new file mode 100644 index 0000000..238697f Binary files /dev/null and b/pyladder/assets/r1.png differ diff --git a/pyladder/assets/red.png b/pyladder/assets/red.png new file mode 100644 index 0000000..1b60f5b Binary files /dev/null and b/pyladder/assets/red.png differ diff --git a/pyladder/assets/robot.png b/pyladder/assets/robot.png new file mode 100644 index 0000000..a5a1ce2 Binary files /dev/null and b/pyladder/assets/robot.png differ diff --git a/pyladder/assets/rules.png b/pyladder/assets/rules.png new file mode 100644 index 0000000..715d16b Binary files /dev/null and b/pyladder/assets/rules.png differ diff --git a/pyladder/assets/wins_computer.png b/pyladder/assets/wins_computer.png new file mode 100644 index 0000000..01e6004 Binary files /dev/null and b/pyladder/assets/wins_computer.png differ diff --git a/pyladder/assets/wins_player.png b/pyladder/assets/wins_player.png new file mode 100644 index 0000000..11b6486 Binary files /dev/null and b/pyladder/assets/wins_player.png differ diff --git a/pyladder/poetry.lock b/pyladder/poetry.lock new file mode 100644 index 0000000..3292b91 --- /dev/null +++ b/pyladder/poetry.lock @@ -0,0 +1,292 @@ +[[package]] +name = "appdirs" +version = "1.4.4" +description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." +category = "dev" +optional = false +python-versions = "*" + +[[package]] +name = "atomicwrites" +version = "1.4.0" +description = "Atomic file writes." +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[[package]] +name = "attrs" +version = "21.2.0" +description = "Classes Without Boilerplate" +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" + +[package.extras] +dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface", "furo", "sphinx", "sphinx-notfound-page", "pre-commit"] +docs = ["furo", "sphinx", "zope.interface", "sphinx-notfound-page"] +tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface"] +tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins"] + +[[package]] +name = "black" +version = "21.7b0" +description = "The uncompromising code formatter." +category = "dev" +optional = false +python-versions = ">=3.6.2" + +[package.dependencies] +appdirs = "*" +click = ">=7.1.2" +mypy-extensions = ">=0.4.3" +pathspec = ">=0.8.1,<1" +regex = ">=2020.1.8" +tomli = ">=0.2.6,<2.0.0" + +[package.extras] +colorama = ["colorama (>=0.4.3)"] +d = ["aiohttp (>=3.6.0)", "aiohttp-cors (>=0.4.0)"] +python2 = ["typed-ast (>=1.4.2)"] +uvloop = ["uvloop (>=0.15.2)"] + +[[package]] +name = "click" +version = "8.0.1" +description = "Composable command line interface toolkit" +category = "dev" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +colorama = {version = "*", markers = "platform_system == \"Windows\""} + +[[package]] +name = "colorama" +version = "0.4.4" +description = "Cross-platform colored terminal text." +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" + +[[package]] +name = "more-itertools" +version = "8.8.0" +description = "More routines for operating on iterables, beyond itertools" +category = "dev" +optional = false +python-versions = ">=3.5" + +[[package]] +name = "mypy-extensions" +version = "0.4.3" +description = "Experimental type system extensions for programs checked with the mypy typechecker." +category = "dev" +optional = false +python-versions = "*" + +[[package]] +name = "packaging" +version = "21.0" +description = "Core utilities for Python packages" +category = "dev" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +pyparsing = ">=2.0.2" + +[[package]] +name = "pathspec" +version = "0.9.0" +description = "Utility library for gitignore style pattern matching of file paths." +category = "dev" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" + +[[package]] +name = "pluggy" +version = "0.13.1" +description = "plugin and hook calling mechanisms for python" +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[package.extras] +dev = ["pre-commit", "tox"] + +[[package]] +name = "py" +version = "1.10.0" +description = "library with cross-python path, ini-parsing, io, code, log facilities" +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[[package]] +name = "pyparsing" +version = "2.4.7" +description = "Python parsing module" +category = "dev" +optional = false +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" + +[[package]] +name = "pytest" +version = "5.4.3" +description = "pytest: simple powerful testing with Python" +category = "dev" +optional = false +python-versions = ">=3.5" + +[package.dependencies] +atomicwrites = {version = ">=1.0", markers = "sys_platform == \"win32\""} +attrs = ">=17.4.0" +colorama = {version = "*", markers = "sys_platform == \"win32\""} +more-itertools = ">=4.0.0" +packaging = "*" +pluggy = ">=0.12,<1.0" +py = ">=1.5.0" +wcwidth = "*" + +[package.extras] +checkqa-mypy = ["mypy (==v0.761)"] +testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"] + +[[package]] +name = "regex" +version = "2021.8.21" +description = "Alternative regular expression module, to replace re." +category = "dev" +optional = false +python-versions = "*" + +[[package]] +name = "tomli" +version = "1.2.1" +description = "A lil' TOML parser" +category = "dev" +optional = false +python-versions = ">=3.6" + +[[package]] +name = "wcwidth" +version = "0.2.5" +description = "Measures the displayed width of unicode strings in a terminal" +category = "dev" +optional = false +python-versions = "*" + +[metadata] +lock-version = "1.1" +python-versions = "^3.8" +content-hash = "e68af64d152238c33ad954f158b7f26a26d97ded6375462c5e6d5a6523154f65" + +[metadata.files] +appdirs = [ + {file = "appdirs-1.4.4-py2.py3-none-any.whl", hash = "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"}, + {file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"}, +] +atomicwrites = [ + {file = "atomicwrites-1.4.0-py2.py3-none-any.whl", hash = "sha256:6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197"}, + {file = "atomicwrites-1.4.0.tar.gz", hash = "sha256:ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a"}, +] +attrs = [ + {file = "attrs-21.2.0-py2.py3-none-any.whl", hash = "sha256:149e90d6d8ac20db7a955ad60cf0e6881a3f20d37096140088356da6c716b0b1"}, + {file = "attrs-21.2.0.tar.gz", hash = "sha256:ef6aaac3ca6cd92904cdd0d83f629a15f18053ec84e6432106f7a4d04ae4f5fb"}, +] +black = [ + {file = "black-21.7b0-py3-none-any.whl", hash = "sha256:1c7aa6ada8ee864db745b22790a32f94b2795c253a75d6d9b5e439ff10d23116"}, + {file = "black-21.7b0.tar.gz", hash = "sha256:c8373c6491de9362e39271630b65b964607bc5c79c83783547d76c839b3aa219"}, +] +click = [ + {file = "click-8.0.1-py3-none-any.whl", hash = "sha256:fba402a4a47334742d782209a7c79bc448911afe1149d07bdabdf480b3e2f4b6"}, + {file = "click-8.0.1.tar.gz", hash = "sha256:8c04c11192119b1ef78ea049e0a6f0463e4c48ef00a30160c704337586f3ad7a"}, +] +colorama = [ + {file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"}, + {file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"}, +] +more-itertools = [ + {file = "more-itertools-8.8.0.tar.gz", hash = "sha256:83f0308e05477c68f56ea3a888172c78ed5d5b3c282addb67508e7ba6c8f813a"}, + {file = "more_itertools-8.8.0-py3-none-any.whl", hash = "sha256:2cf89ec599962f2ddc4d568a05defc40e0a587fbc10d5989713638864c36be4d"}, +] +mypy-extensions = [ + {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, + {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, +] +packaging = [ + {file = "packaging-21.0-py3-none-any.whl", hash = "sha256:c86254f9220d55e31cc94d69bade760f0847da8000def4dfe1c6b872fd14ff14"}, + {file = "packaging-21.0.tar.gz", hash = "sha256:7dc96269f53a4ccec5c0670940a4281106dd0bb343f47b7471f779df49c2fbe7"}, +] +pathspec = [ + {file = "pathspec-0.9.0-py2.py3-none-any.whl", hash = "sha256:7d15c4ddb0b5c802d161efc417ec1a2558ea2653c2e8ad9c19098201dc1c993a"}, + {file = "pathspec-0.9.0.tar.gz", hash = "sha256:e564499435a2673d586f6b2130bb5b95f04a3ba06f81b8f895b651a3c76aabb1"}, +] +pluggy = [ + {file = "pluggy-0.13.1-py2.py3-none-any.whl", hash = "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"}, + {file = "pluggy-0.13.1.tar.gz", hash = "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0"}, +] +py = [ + {file = "py-1.10.0-py2.py3-none-any.whl", hash = "sha256:3b80836aa6d1feeaa108e046da6423ab8f6ceda6468545ae8d02d9d58d18818a"}, + {file = "py-1.10.0.tar.gz", hash = "sha256:21b81bda15b66ef5e1a777a21c4dcd9c20ad3efd0b3f817e7a809035269e1bd3"}, +] +pyparsing = [ + {file = "pyparsing-2.4.7-py2.py3-none-any.whl", hash = "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"}, + {file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"}, +] +pytest = [ + {file = "pytest-5.4.3-py3-none-any.whl", hash = "sha256:5c0db86b698e8f170ba4582a492248919255fcd4c79b1ee64ace34301fb589a1"}, + {file = "pytest-5.4.3.tar.gz", hash = "sha256:7979331bfcba207414f5e1263b5a0f8f521d0f457318836a7355531ed1a4c7d8"}, +] +regex = [ + {file = "regex-2021.8.21-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:4b0c211c55d4aac4309c3209833c803fada3fc21cdf7b74abedda42a0c9dc3ce"}, + {file = "regex-2021.8.21-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5d5209c3ba25864b1a57461526ebde31483db295fc6195fdfc4f8355e10f7376"}, + {file = "regex-2021.8.21-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c835c30f3af5c63a80917b72115e1defb83de99c73bc727bddd979a3b449e183"}, + {file = "regex-2021.8.21-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:615fb5a524cffc91ab4490b69e10ae76c1ccbfa3383ea2fad72e54a85c7d47dd"}, + {file = "regex-2021.8.21-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9966337353e436e6ba652814b0a957a517feb492a98b8f9d3b6ba76d22301dcc"}, + {file = "regex-2021.8.21-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:a49f85f0a099a5755d0a2cc6fc337e3cb945ad6390ec892332c691ab0a045882"}, + {file = "regex-2021.8.21-cp310-cp310-win32.whl", hash = "sha256:f93a9d8804f4cec9da6c26c8cfae2c777028b4fdd9f49de0302e26e00bb86504"}, + {file = "regex-2021.8.21-cp310-cp310-win_amd64.whl", hash = "sha256:a795829dc522227265d72b25d6ee6f6d41eb2105c15912c230097c8f5bfdbcdc"}, + {file = "regex-2021.8.21-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:bca14dfcfd9aae06d7d8d7e105539bd77d39d06caaae57a1ce945670bae744e0"}, + {file = "regex-2021.8.21-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:41acdd6d64cd56f857e271009966c2ffcbd07ec9149ca91f71088574eaa4278a"}, + {file = "regex-2021.8.21-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:96f0c79a70642dfdf7e6a018ebcbea7ea5205e27d8e019cad442d2acfc9af267"}, + {file = "regex-2021.8.21-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:45f97ade892ace20252e5ccecdd7515c7df5feeb42c3d2a8b8c55920c3551c30"}, + {file = "regex-2021.8.21-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1f9974826aeeda32a76648fc677e3125ade379869a84aa964b683984a2dea9f1"}, + {file = "regex-2021.8.21-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:ea9753d64cba6f226947c318a923dadaf1e21cd8db02f71652405263daa1f033"}, + {file = "regex-2021.8.21-cp36-cp36m-win32.whl", hash = "sha256:ef9326c64349e2d718373415814e754183057ebc092261387a2c2f732d9172b2"}, + {file = "regex-2021.8.21-cp36-cp36m-win_amd64.whl", hash = "sha256:6dbd51c3db300ce9d3171f4106da18fe49e7045232630fe3d4c6e37cb2b39ab9"}, + {file = "regex-2021.8.21-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:a89ca4105f8099de349d139d1090bad387fe2b208b717b288699ca26f179acbe"}, + {file = "regex-2021.8.21-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d6c2b1d78ceceb6741d703508cd0e9197b34f6bf6864dab30f940f8886e04ade"}, + {file = "regex-2021.8.21-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a34ba9e39f8269fd66ab4f7a802794ffea6d6ac500568ec05b327a862c21ce23"}, + {file = "regex-2021.8.21-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:ecb6e7c45f9cd199c10ec35262b53b2247fb9a408803ed00ee5bb2b54aa626f5"}, + {file = "regex-2021.8.21-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:330836ad89ff0be756b58758878409f591d4737b6a8cef26a162e2a4961c3321"}, + {file = "regex-2021.8.21-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:71a904da8c9c02aee581f4452a5a988c3003207cb8033db426f29e5b2c0b7aea"}, + {file = "regex-2021.8.21-cp37-cp37m-win32.whl", hash = "sha256:b511c6009d50d5c0dd0bab85ed25bc8ad6b6f5611de3a63a59786207e82824bb"}, + {file = "regex-2021.8.21-cp37-cp37m-win_amd64.whl", hash = "sha256:93f9f720081d97acee38a411e861d4ce84cbc8ea5319bc1f8e38c972c47af49f"}, + {file = "regex-2021.8.21-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:3a195e26df1fbb40ebee75865f9b64ba692a5824ecb91c078cc665b01f7a9a36"}, + {file = "regex-2021.8.21-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:06ba444bbf7ede3890a912bd4904bb65bf0da8f0d8808b90545481362c978642"}, + {file = "regex-2021.8.21-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8b8d551f1bd60b3e1c59ff55b9e8d74607a5308f66e2916948cafd13480b44a3"}, + {file = "regex-2021.8.21-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:ebbceefbffae118ab954d3cd6bf718f5790db66152f95202ebc231d58ad4e2c2"}, + {file = "regex-2021.8.21-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ccd721f1d4fc42b541b633d6e339018a08dd0290dc67269df79552843a06ca92"}, + {file = "regex-2021.8.21-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:ae87ab669431f611c56e581679db33b9a467f87d7bf197ac384e71e4956b4456"}, + {file = "regex-2021.8.21-cp38-cp38-win32.whl", hash = "sha256:38600fd58c2996829480de7d034fb2d3a0307110e44dae80b6b4f9b3d2eea529"}, + {file = "regex-2021.8.21-cp38-cp38-win_amd64.whl", hash = "sha256:61e734c2bcb3742c3f454dfa930ea60ea08f56fd1a0eb52d8cb189a2f6be9586"}, + {file = "regex-2021.8.21-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:b091dcfee169ad8de21b61eb2c3a75f9f0f859f851f64fdaf9320759a3244239"}, + {file = "regex-2021.8.21-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:640ccca4d0a6fcc6590f005ecd7b16c3d8f5d52174e4854f96b16f34c39d6cb7"}, + {file = "regex-2021.8.21-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ac95101736239260189f426b1e361dc1b704513963357dc474beb0f39f5b7759"}, + {file = "regex-2021.8.21-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:b79dc2b2e313565416c1e62807c7c25c67a6ff0a0f8d83a318df464555b65948"}, + {file = "regex-2021.8.21-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d8b623fc429a38a881ab2d9a56ef30e8ea20c72a891c193f5ebbddc016e083ee"}, + {file = "regex-2021.8.21-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:8021dee64899f993f4b5cca323aae65aabc01a546ed44356a0965e29d7893c94"}, + {file = "regex-2021.8.21-cp39-cp39-win32.whl", hash = "sha256:d6ec4ae13760ceda023b2e5ef1f9bc0b21e4b0830458db143794a117fdbdc044"}, + {file = "regex-2021.8.21-cp39-cp39-win_amd64.whl", hash = "sha256:03840a07a402576b8e3a6261f17eb88abd653ad4e18ec46ef10c9a63f8c99ebd"}, + {file = "regex-2021.8.21.tar.gz", hash = "sha256:faf08b0341828f6a29b8f7dd94d5cf8cc7c39bfc3e67b78514c54b494b66915a"}, +] +tomli = [ + {file = "tomli-1.2.1-py3-none-any.whl", hash = "sha256:8dd0e9524d6f386271a36b41dbf6c57d8e32fd96fd22b6584679dc569d20899f"}, + {file = "tomli-1.2.1.tar.gz", hash = "sha256:a5b75cb6f3968abb47af1b40c1819dc519ea82bcc065776a866e8d74c5ca9442"}, +] +wcwidth = [ + {file = "wcwidth-0.2.5-py2.py3-none-any.whl", hash = "sha256:beb4802a9cebb9144e99086eff703a642a13d6a0052920003a230f3294bbe784"}, + {file = "wcwidth-0.2.5.tar.gz", hash = "sha256:c4d647b99872929fdb7bdcaa4fbe7f01413ed3d98077df798530e5b04f116c83"}, +] diff --git a/pyladder/pyladder/__init__.py b/pyladder/pyladder/__init__.py new file mode 100644 index 0000000..b794fd4 --- /dev/null +++ b/pyladder/pyladder/__init__.py @@ -0,0 +1 @@ +__version__ = '0.1.0' diff --git a/pyladder/pyladder/__pycache__/__init__.cpython-38.pyc b/pyladder/pyladder/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..8803270 Binary files /dev/null and b/pyladder/pyladder/__pycache__/__init__.cpython-38.pyc differ diff --git a/pyladder/pyladder/pyladder.py b/pyladder/pyladder/pyladder.py new file mode 100644 index 0000000..8666ae8 --- /dev/null +++ b/pyladder/pyladder/pyladder.py @@ -0,0 +1,582 @@ +# Importing +import pygame +import re +from random import randint + +clock = pygame.time.Clock() + +# Initialization +pygame.init() +width = 1366 +height = 768 + + +# Icon layout and caption +icon = pygame.image.load("./pyladder/assets/icon.jpg") +game_layout = pygame.display.set_mode((width, height)) +pygame.display.set_caption("Pyladder Game") +pygame.display.set_icon(icon) +pygame.display.update() + + +Board = pygame.image.load("./pyladder/assets/Snakes_ladders_big_image.png") +Menu = pygame.image.load("./pyladder/assets/menu.jpg") +Background = pygame.image.load("./pyladder/assets/game_background.jpg") +ourrules = pygame.image.load("./pyladder/assets/rules.png") +ourrules = pygame.transform.smoothscale(ourrules, (width, height)) +back1 = pygame.image.load("./pyladder/assets/introduction_image.png") +back2 = pygame.image.load("./pyladder/assets/introduction_image2.png") +back3 = pygame.image.load("./pyladder/assets/introduction_image3.png") +back4 = pygame.image.load("./pyladder/assets/introduction_image4.png") +back5 = pygame.image.load("./pyladder/assets/introduction_image5.png") + +asac_project = pygame.image.load("./pyladder/assets/ASAC.png") +asac_project = pygame.transform.smoothscale(asac_project, (width, height)) + +# All Point +red_token = pygame.image.load("./pyladder/assets/robot.png") +red_token = pygame.transform.smoothscale(red_token, (55, 53)) + +blue_token = pygame.image.load("./pyladder/assets/man.png") +blue_token = pygame.transform.smoothscale(blue_token, (55, 52)) + +# All Dice +dice1 = pygame.image.load("./pyladder/assets/dice_image1.png") +dice2 = pygame.image.load("./pyladder/assets/dice_image2.png") +dice3 = pygame.image.load("./pyladder/assets/dice_image3.png") +dice4 = pygame.image.load("./pyladder/assets/dice_image4.png") +dice5 = pygame.image.load("./pyladder/assets/dice_image5.png") +dice6 = pygame.image.load("./pyladder/assets/dice_image6.png") + +# Sounds +pygame.mixer.music.load("./pyladder/sound/song1.wav") # And menu first line +snake_sound = pygame.mixer.Sound("./pyladder/sound/snake2.wav") +ladder_sound = pygame.mixer.Sound("./pyladder/sound/ladder2.wav") +win_sound = pygame.mixer.Sound("./pyladder/sound/win1.wav") +lose_sound = pygame.mixer.Sound("./pyladder/sound/loss3.wav") +dice_sound = pygame.mixer.Sound("./pyladder/sound/dice1.wav") + +# img Win & loss +wins_player = pygame.image.load("./pyladder/assets/wins_player.png") +loss_player = pygame.image.load("./pyladder/assets/loss_player.png") +wins_computer = pygame.image.load("./pyladder/assets/wins_computer.png") +loss_computer = pygame.image.load("./pyladder/assets/loss_computer.png") + +# Position of mouse +mouse = pygame.mouse.get_pos() + +# Last Question +last_question = [] + +# prompt text when player/computer wins the game , or when a player cant move due to movments being higher than 100 +def display_text(text, x, y, fontsize): + Textsize = pygame.font.SysFont("couriernew", fontsize) + Texts, TextBox = text_reshape(text, Textsize) + TextBox.center = (x, y) + game_layout.blit(Texts, TextBox) +# text reshape +def text_reshape(text, font): + Texts = font.render(text, True, (250, 250, 250)) + return Texts, Texts.get_rect() +# prompt Messagewhen there is a ladder or a snake +def display_text2(text, x, y, fontsize,c): + Textsize = pygame.font.SysFont("courier new", fontsize) + texts, TextBox = text_reshape2(text, Textsize,c) + TextBox.center = (x, y) + game_layout.blit(texts, TextBox) + +def text_reshape2(text, font, c): + Texts = font.render(text, True, c) + return Texts, Texts.get_rect() + +# Goti movement function Yousef (returning x and y cooridinates) +def moving(a): + l1 = [[406, 606], [456, 606], [506, 606], [556, 606], [606, 606], [656, 606], [706, 606], [756, 606], [806, 606], + [856, 606], [906, 606], [906, 560], [856, 560], [806, 560], [756, 560], [706, 560], [656, 560], [606, 560], + [556, 560], [506, 560], [456, 560], [456, 506], [506, 506], [556, 506], [606, 506], [656, 506], [706, 506], + [756, 506], [806, 506], [856, 506], [906, 506], [906, 460], [856, 460], [806, 460], [756, 460], [706, 460], + [656, 460], [606, 460], [556, 460], [506, 460], [456, 460], [456, 406], [506, 406], [556, 406], [606, 406], + [656, 406], [706, 406], [756, 406], [806, 406], [856, 406], [906, 406], [906, 360], [856, 360], [806, 360], + [756, 360], [706, 360], [656, 360], [606, 360], [556, 360], [506, 360], [456, 360], [456, 306], [506, 306], + [556, 306], [606, 306], [656, 306], [706, 306], [756, 306], [806, 306], [856, 306], [906, 306], [906, 260], + [856, 260], [806, 260], [756, 260], [706, 260], [656, 260], [606, 260], [556, 260], [506, 260], [456, 260], + [456, 206], [506, 206], [556, 206], [606, 206], [656, 206], [706, 206], [756, 206], [806, 206], [856, 206], + [906, 206], [906, 160], [856, 160], [806, 160], [756, 160], [706, 160], [656, 160], [606, 160], [556, 160], + [506, 160], [456, 160]] + l2 = l1[a] + x = l2[0] - 25 + y = l2[1] - 25 + return x, y + +# Ladder check maram +def ladders(x,rounds): + if x == 1: + if math(rounds): + return 38 + else: + return 1 + elif x == 4: + if math(rounds): + return 14 + else: + return 4 + elif x == 9: + if math(rounds): + return 31 + else: + return 9 + elif x == 28: + if math(rounds): + return 84 + else: + return 28 + elif x == 21: + if math(rounds): + return 42 + else: + return 21 + elif x == 51: + if math(rounds): + return 67 + else: + return 51 + elif x == 80: + if math(rounds): + return 99 + else: + return 80 + elif x == 72: + if math(rounds): + return 91 + else: + return 72 + else: + return x + +# Snake Check Omar +def snakes(x,rounds): + if x == 17: + if math(rounds): + return 17 + else: + return 7 + elif x == 54: + if math(rounds): + return 54 + else: + return 34 + elif x == 62: + if math(rounds): + return 62 + else: + return 19 + elif x == 64: + if math(rounds): + return 64 + else: + return 60 + elif x == 87: + if math(rounds): + return 87 + else: + return 36 + elif x == 93: + if math(rounds): + return 93 + else: + return 73 + elif x == 95: + if math(rounds): + return 95 + else: + return 75 + elif x == 98: + if math(rounds): + return 98 + else: + return 79 + else: + return x +# dices and thier images Yousef (to do: change time) +def dice(d,rounds): + if d == 1: + d = dice1 + elif d == 2: + d = dice2 + elif d == 3: + d = dice3 + elif d == 4: + d = dice4 + elif d == 5: + d = dice5 + elif d == 6: + d = dice6 + if rounds==1: + clock = pygame.time.get_ticks() + while pygame.time.get_ticks() - clock < 800: + game_layout.blit(d, (160, 300)) + pygame.display.update() + else: + clock = pygame.time.get_ticks() + while pygame.time.get_ticks() - clock < 800: + game_layout.blit(d, (1100, 300)) + pygame.display.update() + + # for mute and unmute +# Quitting: +def Quit(): + pygame.quit() + quit() +# Button: +def button(text, xmouse, ymouse, x, y, width, height, int, new, size,btn_1): + if x + width > xmouse > x and y + height > ymouse > y: + pygame.draw.rect(game_layout, new, [x - 2.5, y - 2.5, width + 5, height + 5]) + if pygame.mouse.get_pressed() == (1, 0, 0): + if btn_1 == 1: + playing(10) + elif btn_1 == 0: + Quit() + elif btn_1 == 15: + rules() + elif btn_1 == "single": + return btn_1 + else: + return True + else: + pygame.draw.rect(game_layout, int, [x, y, width, height]) + display_text(text, (x + width + x) / 2, (y + height + y) / 2, size) +# game rules +def rules(): + while True: + for event in pygame.event.get(): + if event.type == pygame.KEYDOWN: + if event.key == pygame.K_ESCAPE: + Quit() + clock = pygame.time.get_ticks() + while True: + while pygame.time.get_ticks() - clock < 500: + game_layout.blit(ourrules, (0, 0)) + pygame.display.update() + for event in pygame.event.get(): + if event.type == pygame.KEYDOWN: + return + pygame.display.update() +# Game lunching +def starter(): + time_clock = pygame.time.get_ticks() + while pygame.time.get_ticks() - time_clock < 2500: + game_layout.blit(back1, (0, 0)) + pygame.display.update() + # note we may reomve those ones + while True: + time_clock = pygame.time.get_ticks() + while pygame.time.get_ticks() - time_clock < 500: + game_layout.blit(back2, (0, 0)) + pygame.display.update() + time_clock = pygame.time.get_ticks() + while pygame.time.get_ticks() - time_clock < 500: + game_layout.blit(back3, (0, 0)) + pygame.display.update() + time_clock = pygame.time.get_ticks() + while pygame.time.get_ticks() - time_clock < 500: + game_layout.blit(back4, (0, 0)) + pygame.display.update() + time_clock = pygame.time.get_ticks() + while pygame.time.get_ticks() - time_clock < 500: + game_layout.blit(back5, (0, 0)) + pygame.display.update() + + for event in pygame.event.get(): + if event.type == pygame.KEYDOWN: + return + pygame.display.update() +# about our project and team members +def ASAC(): + while True: + game_layout.blit(asac_project, (0, 0)) + for event in pygame.event.get(): + if event.type == pygame.KEYDOWN: + if event.key == pygame.K_ESCAPE: + Quit() + mouse = pygame.mouse.get_pos() + if button("Back", mouse[0], mouse[1], width / 2 - 120, 680, 200, 70, (113, 207, 41, 1), (0, 230, 0), 60, 2): + menu() + pygame.display.update() +# Main Menu of our game +def menu(): + pygame.mixer.music.play(-1) + while True: + for event in pygame.event.get(): + if event.type == pygame.QUIT: + Quit() + if event.type == pygame.KEYDOWN: + if event.key == pygame.K_ESCAPE: + Quit() + mouse = pygame.mouse.get_pos() + game_layout.blit(Menu, (0, 0)) + button("Play", mouse[0], mouse[1], (width / 2 - 100), 330, 200, 100, (113, 207, 41, 1),(0, 230, 0), 60, 1) + button("Rules", mouse[0], mouse[1], (width / 2 - 100), 370 + 70, 200, 100, (113, 207, 41, 1),(0, 230, 0), 60, 15) + button("Quit", mouse[0], mouse[1], (width / 2 - 100), 440 + 110, 200, 100, (113, 207, 41, 1),(0, 230, 0), 60, 0) + mouse = pygame.mouse.get_pos() + if button("PyLadder", mouse[0], mouse[1], 1166, 0, 200, 50, (113, 207, 41, 1),(0, 230, 0), 30,2): + ASAC() + pygame.display.update() +# Options Menu after chosing Play: +def chosen(): + while True: + for event in pygame.event.get(): + if event.type == pygame.QUIT: + Quit() + if event.type == pygame.KEYDOWN: + if event.key == pygame.K_ESCAPE: + Quit() + mouse = pygame.mouse.get_pos() + game_layout.blit(Menu, (0, 0)) + # Single player button + btn_1 = button("Against Computer", mouse[0], mouse[1], (330),400,750,100,(113, 207, 41, 1), + (0, 230, 0), 40,"single") + mouse = pygame.mouse.get_pos() + btn_2 = button("Back to Main", mouse[0], mouse[1], 10, 700, 300, 50,(113, 207, 41, 1),(0, 230, 0), 30, 5) + if btn_2 == 5: + menu() + if btn_1 == "single": + playing(10) + pygame.display.update() +# Turn +def turn(score, go_up, swallowed,rounds): + # roll a dice using random number between 1 and 6 + d = randint(1, 6) + # print(type(d)) + pygame.mixer.Sound.play(dice_sound) + if d != 6: + dice(d,rounds) + six = False + else: + dice(d,rounds) + if rounds==1: + clock = pygame.time.get_ticks() + while pygame.time.get_ticks() - clock < 1500: + display_text(" HOT DICE", 210, 270, 40) + pygame.display.update() + six = True + if rounds==2: + clock = pygame.time.get_ticks() + while pygame.time.get_ticks() - clock < 1500: + display_text(" HOT DICE", 1150, 270, 40) + pygame.display.update() + six = True + score += d + # if score is 100 or less + if score <= 100: + ladd_score = ladders(score,rounds) # checking for ladders for player + if ladd_score != score: + go_up = True + pygame.mixer.Sound.play(ladder_sound) + score = ladd_score + snake_score = snakes(score,rounds) + if snake_score != score: + swallowed = True + pygame.mixer.Sound.play(snake_sound) + score = snake_score + # if score is not grater than 100 + else: + if rounds==1: + score -= d + clock = pygame.time.get_ticks() + while pygame.time.get_ticks() - clock < 500: + display_text("YOU CANT MOVE!", 220, 210, 40) + pygame.display.update() + if rounds==2: + score -= d + clock = pygame.time.get_ticks() + while pygame.time.get_ticks() - clock < 500: + display_text("YOU CANT MOVE!", 1170, 210, 40) + pygame.display.update() + return score, go_up, swallowed, six + +def playing(btn1): + game_layout.blit(Background, (0, 0)) + game_layout.blit(Board, (width / 2 - 250, height / 2 - 250)) + player1_x_c = 406 - 25 + player1_y_c = 606 - 25 + comp_x_c = 1006 - 25-40 + comp_y_c = 606 - 25 + game_layout.blit(red_token, (comp_x_c, comp_y_c)) + game_layout.blit(blue_token, (player1_x_c, player1_y_c)) + player1_score = 99 + computer_score = 99 + rounds = 1 + while True: + up=False + down=False + time=5500 + game_layout.blit(Background, (0, 0)) + game_layout.blit(Board, (width / 2 - 250, height / 2 - 250)) + mouse = pygame.mouse.get_pos() + # whenever escape is pressed quit the game + for event in pygame.event.get(): + if event.type == pygame.QUIT: + Quit() + if event.type == pygame.KEYDOWN: + if event.key == pygame.K_ESCAPE: + Quit() + green_color = (113, 207, 41, 1) + light_green_color = (0, 230, 0) + + # print(btn1) + if btn1: + if button("Click to Roll", mouse[0], mouse[1], 50, 138, 350, 50, green_color, light_green_color, 40, btn1): + if rounds == 1: + player1_score, up, down, six = turn(player1_score, up, down,rounds) + # tempx,tempy=player1_x_c, player1_y_c + player1_x_c, player1_y_c = moving(player1_score) + if not six: + rounds += 1 + if player1_score == 100: + time = pygame.time.get_ticks() + while pygame.time.get_ticks() - time < 2500: + display_text("Congratulations You WON !", 700, 50, 60) + pygame.mixer.music.pause() + while pygame.time.get_ticks() - time < 00: + game_layout.blit(wins_player, (-5, height / 2 +70)) + game_layout.blit(loss_computer, (width - 120, height / 2+70)) + pygame.display.update() + pygame.mixer.Sound.play(win_sound) + pygame.mixer.music.unpause() + pygame.display.update() + + + game_layout.blit(red_token, (comp_x_c ,comp_y_c )) + if btn1 == 10: + game_layout.blit(blue_token, (player1_x_c + 2, player1_y_c)) + + button("Computer", mouse[0], mouse[1], 1050, 138, 220, 50, green_color, light_green_color, 40,btn1) + if rounds == 2: + computer_score, up, down, six = turn(computer_score, up, down,rounds) + comp_x_c, comp_y_c = moving(computer_score) + if not six: + rounds += 1 + if btn1 == 10: + rounds = 1 + computer_score == 100 + if computer_score == 100: + time_clock = pygame.time.get_ticks() + while pygame.time.get_ticks() - time_clock < 5000: + display_text("Computer Won !", 1066, 50, 60) + pygame.mixer.music.pause() + while pygame.time.get_ticks() - time_clock < 2500: + game_layout.blit(wins_computer, (width - 250, height / 2 + 70)) + game_layout.blit(loss_player, (-5, height / 2 +70)) + pygame.display.update() + pygame.mixer.Sound.play(lose_sound) + pygame.mixer.music.unpause() + pygame.display.update() + + clock.tick() + pygame.display.update() + + +def math(rounds): + if rounds == 1: + font = pygame.font.Font(None, 32) + input_box = pygame.Rect(585, 570, 140, 32) + + questions = [["./pyladder/assets/question/q1.jpg", '96'], + ["./pyladder/assets/question/q2.jpg", '111'], + ["./pyladder/assets/question/q3.jpg", '72'], + ["./pyladder/assets/question/q4.png", '255'], + ["./pyladder/assets/question/q5.jpg", '9'], + ["./pyladder/assets/question/q6.png", '86'], + ["./pyladder/assets/question/q7.png", '23'], + ["./pyladder/assets/question/q8.jpg", '6'], + ["./pyladder/assets/question/q9.jpg", '12'], + ["./pyladder/assets/question/q10.jpg", '5'], + ["./pyladder/assets/question/q11.jpg", '25'], + ["./pyladder/assets/question/q12.jpg", '16'], + ["./pyladder/assets/question/q13.jpg", '16'], + ["./pyladder/assets/question/q14.jpg", '45'], + ["./pyladder/assets/question/q15.jpg", '51'], + ["./pyladder/assets/question/q16.jpg", '9'], + ["./pyladder/assets/question/q17.jpg", '7']] + read_q = randint(0, 16) + get_question = True + + while get_question: + if questions[read_q][0] in last_question: + read_q = randint(0, 16) + else: + last_question.append(questions[read_q][0]) + get_question = False + + # print(last_question) + question = pygame.image.load(questions[read_q][0]) + answer = questions[read_q][1] + + + color_inactive = pygame.Color('lightskyblue3') + color_active = pygame.Color('dodgerblue2') + color = color_inactive + + active = False + text = '' + done = False + + while not done: + for event in pygame.event.get(): + if event.type == pygame.QUIT: + Quit() + + if event.type == pygame.MOUSEBUTTONDOWN: + # If the user clicked on the input_box rect. + if input_box.collidepoint(event.pos): + # Toggle the active variable. + active = not active + else: + active = False + # Change the current color of the input box. + color = color_active if active else color_inactive + if event.type == pygame.KEYDOWN: + if active: + if event.key == pygame.K_RETURN: + # check if the player answer the question + if text: + if text == answer: + return True + else: + return False + elif event.key == pygame.K_BACKSPACE: + text = text[:-1] + else: + check_text = re.findall('[0-9]', event.unicode) + if check_text: + text += event.unicode + + + pygame.draw.rect(game_layout, (30, 30, 30), pygame.Rect(433, 134, 500, 500)) + game_layout.blit(question, (433, 134)) + + # Render the current text. + txt_surface = font.render(text, True, color) + + # Resize the box if the text is too long. + width_box = max(200, txt_surface.get_width()+10) + + input_box.w = width_box + + # Blit the text. + game_layout.blit(txt_surface, (input_box.x+5, input_box.y+5)) + + # Blit the input_box rect. + pygame.draw.rect(game_layout, color, input_box, 2) + pygame.display.update() + game_layout.blit(Board, (width / 2 - 250, height / 2 - 250)) + else: + # computer will have 50/50 chance to have a correct answer + computer_answer = randint(0,1) + print(computer_answer) + if computer_answer==0: + return False + else: + return True +starter() +menu() \ No newline at end of file diff --git a/pyladder/pyproject.toml b/pyladder/pyproject.toml new file mode 100644 index 0000000..bca3d6c --- /dev/null +++ b/pyladder/pyproject.toml @@ -0,0 +1,16 @@ +[tool.poetry] +name = "pyladder" +version = "0.1.0" +description = "" +authors = ["YousefAbu-Jalboush "] + +[tool.poetry.dependencies] +python = "^3.8" + +[tool.poetry.dev-dependencies] +pytest = "^5.2" +black = {version = "^21.7b0", allow-prereleases = true} + +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" diff --git a/pyladder/sound/Win.wav b/pyladder/sound/Win.wav new file mode 100644 index 0000000..6c9214f Binary files /dev/null and b/pyladder/sound/Win.wav differ diff --git a/pyladder/sound/dice1.wav b/pyladder/sound/dice1.wav new file mode 100644 index 0000000..80e81d7 Binary files /dev/null and b/pyladder/sound/dice1.wav differ diff --git a/pyladder/sound/ladder.wav b/pyladder/sound/ladder.wav new file mode 100644 index 0000000..81277b2 Binary files /dev/null and b/pyladder/sound/ladder.wav differ diff --git a/pyladder/sound/ladder2.wav b/pyladder/sound/ladder2.wav new file mode 100644 index 0000000..e4b1e39 Binary files /dev/null and b/pyladder/sound/ladder2.wav differ diff --git a/pyladder/sound/lose.wav b/pyladder/sound/lose.wav new file mode 100644 index 0000000..f7155a9 Binary files /dev/null and b/pyladder/sound/lose.wav differ diff --git a/pyladder/sound/loss2.wav b/pyladder/sound/loss2.wav new file mode 100644 index 0000000..8f64f4f Binary files /dev/null and b/pyladder/sound/loss2.wav differ diff --git a/pyladder/sound/loss3.wav b/pyladder/sound/loss3.wav new file mode 100644 index 0000000..9a5c978 Binary files /dev/null and b/pyladder/sound/loss3.wav differ diff --git a/pyladder/sound/loss4.wav b/pyladder/sound/loss4.wav new file mode 100644 index 0000000..f324b3f Binary files /dev/null and b/pyladder/sound/loss4.wav differ diff --git a/pyladder/sound/music.wav b/pyladder/sound/music.wav new file mode 100644 index 0000000..dd6872e Binary files /dev/null and b/pyladder/sound/music.wav differ diff --git a/pyladder/sound/snake.wav b/pyladder/sound/snake.wav new file mode 100644 index 0000000..c6963ef Binary files /dev/null and b/pyladder/sound/snake.wav differ diff --git a/pyladder/sound/snake2.wav b/pyladder/sound/snake2.wav new file mode 100644 index 0000000..3267ca2 Binary files /dev/null and b/pyladder/sound/snake2.wav differ diff --git a/pyladder/sound/song1.wav b/pyladder/sound/song1.wav new file mode 100644 index 0000000..6c79061 Binary files /dev/null and b/pyladder/sound/song1.wav differ diff --git a/pyladder/sound/win1.wav b/pyladder/sound/win1.wav new file mode 100644 index 0000000..ff89c44 Binary files /dev/null and b/pyladder/sound/win1.wav differ diff --git a/pyladder/sound/win2.wav b/pyladder/sound/win2.wav new file mode 100644 index 0000000..d501f8f Binary files /dev/null and b/pyladder/sound/win2.wav differ diff --git a/pyladder/tests/__init__.py b/pyladder/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pyladder/tests/__pycache__/__init__.cpython-38.pyc b/pyladder/tests/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..a14e6e1 Binary files /dev/null and b/pyladder/tests/__pycache__/__init__.cpython-38.pyc differ diff --git a/pyladder/tests/__pycache__/test_pyladder.cpython-38-pytest-5.4.3.pyc b/pyladder/tests/__pycache__/test_pyladder.cpython-38-pytest-5.4.3.pyc new file mode 100644 index 0000000..7cac59e Binary files /dev/null and b/pyladder/tests/__pycache__/test_pyladder.cpython-38-pytest-5.4.3.pyc differ diff --git a/pyladder/tests/test_pyladder.py b/pyladder/tests/test_pyladder.py new file mode 100644 index 0000000..6229591 --- /dev/null +++ b/pyladder/tests/test_pyladder.py @@ -0,0 +1,5 @@ +from pyladder import __version__ + + +def test_version(): + assert __version__ == '0.1.0'