Skip to content

Repository files navigation

15-mini-standard-library python-games

Introduction

This project aims to teach Python fundamentals through hands-on game development. These are the subjects this tutorial covers

  1. Basic Syntax, Input & Output : PRINT, INPUT, F-string, Variable, Functions

  2. Control Flow & Loops : If Elif and else statement, while loop, For loop

  3. Basic Data Structures : List, Dictionary, Nested Dictionary

  4. Error Handling : Try and Except Statement

  5. Object-Oriented Programming (OOP) & Modularity : Class and Import statement

Games are built on the concepts taught in previous games, so beginners are strongly recommended to complete Games 1 through 10 in sequential order. Once you have gone through all 10 games and understood the code, you will have a strong foundation to specialize and start using external tools like libraries and game engines to further your learning. I will only cover the other 5 bonus games and the "endgame task" if you feel you need more practice within the standard library.

Game Guide

If you do not undestand the code or a specific concept, you can research it on the internet or ask AI. Once you understand the code, add additional features and expand the game to make it your own.

  1. Dice with Death = Simple dice game with death, you win you live. You lose, your soul is his. This is a very basic game using USER-DEFINED, BUILT IN functions, VARIABLES and IF STATEMENTS

  2. Hacker= Goal of the game is to hack into Robert's account. The more attempts, the more clues it provides. Implement the use of INPUT function, VARIABLES, WHILE loop, BREAK statement and IF ELSE STATEMENTS.

  3. The lord, the hunter and the fox= alternative to Rock, Paper, Scissors. Using LIST data type and IF,ELIF and ELSE STATEMENTS.

  4. Dungeon Hack = an adventure simulation game. You need to pick a band of adventurers and complete a dungeon run. Depending on the combination of adventurers it will dictate the outcome of the dungeon run. Using FOR LOOP.

  5. The Haunted House = A mini adventure game. Your main goal is to escape the house with the loot. Using NESTED DICTIONARY data type.

  6. The Slumber of the Doom King= Break into the Doom King's castle and steal as much gold as possible and find an escape before the king consumes your soul. Using DICTIONARY,NESTED DICTIONARY and RETURN function.

  7. Blood Pit= Fight a selection of monsters in the blood pit to gain reputation and glory. Demonstrate how to use 'F string' and a user defined function with multiple arguments.

  8. Battle Master = Build the optimal army to defeat the dreaded orcs. Implement the use of TRY and EXCEPT statements

  9. Who Dare Win= A tactical dice game with a high score save function. Demonstrate how to OPEN/READ/WRITE TXT.FILES as well as an example of 'clear screen' function.

  10. A Grot's Life (A, B, C) = A Survival crafting Game written in standard library where you play as a grot doing what a grot does. Version (A) Introduces Class and Objects whilst Version (B) Provides steps to transform it to a more 'complete' object oriented programme. Version (C) implements 'IMPORT' transferring functions/class/lists to USER DEFINED modules (MODULARITY) which helps organise large code base

Endgame

If you want to 'expand' your learning. I would recommend using the below 2d Ascii RPG game engine to create your own mini adventures

The Engine provides an example of 'Type Hints' and 'Doc string'

Type hints in Python are annotations that tell you (and your tools) what types a function expects and what it returns, without affecting how the code runs.

A docstring (documentation string) is a triple‑quoted string written directly under a function, class, or module definition. Docstrings provide human‑readable explanations of what code does.

https://github.com/Ninedeadeyes/Spark-Standard-Python-Adventure-RPG-Kit-/

Bonus Games

Mini gamble = A simple 'Shell' game where you make bets on which pot the stone is under. Implement INT function converting 'string' to integer.

The Road To Eden = Make hard decisions as you make your way to the city of Eden. Demonstrate how to open and read multiple lines/elements within a txt.file.

The King's Curse = A simple text based adventure using Ascii graphics taken from https://www.asciiart.eu/

One Click RPG= An Idle RPG. Using TUPLES data type, Using TKINTER GUI library ( part of the standard library )

Space Rescue = Rescue the red ships and avoid the rocks. Using TURTLE GRAPHICS library ( part of the standard library )

Youtube Video

https://www.youtube.com/watch?v=ike4KGsFM2Y

About

A collection of 10 mini games/projects written with Python 3 standard library, each game scales in complexity. Includes 5 bonus games for additional examples and learning.

Topics

Resources

Stars

42 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages