Photo by Jon Tyson on Unsplash
In this project I would like to describe how I made a few simple games without graphical graphical interface, focusing mainly on the code (backend).
You can also write games with a graphics engine in Python, and the most popular library for this purpose is Pygame. In the future I am going to write a game using the mentioned library, but there will be time for that. The games that I wrote are very simple and writing them was a form of relaxation for me.
In this project I will not elaborate too much, because there are no analyzes or charts to describe here, and the topic itself is quite simple.
Therefore, I will share the code and I decided to show how the games I wrote look like and how they work.
For this, I used the Xbox Game Bar tool to record my screen and I have uploaded the videos into the YouTube platform.
Game #1: "Guessing Game - User mode"
The player's task is to guess a random value, selected by the computer in a range from 1 to 10
Code:
|
Video:
Game #2: "Guessing Game - Computer mode"
The roles are reversed in here and our task is to choose a digit in the same range (from 1 to 10) and the computer's task is to guess our value.
Code:
|
Video:
Game #3: "Rock Scissors Paper"
At the beginning of this game, you need to decide how many rounds the game should take.
The goal of the game is to choose: paper ('P'), rock ('R') or scissors ('S') and wait for the computer's move. The scoreboard is up-to-date during the game, and once the game is over, the player with the most points wins.
Code:
|
Video:
Game #4: "Hangman"
In this game, our task is to guess the word drawn by the computer from a list of nearly 2,500 English words.
In the game we choose the letters that we think are part of the given word. We can make 5 mistakes, and after using this limit, we lose the game. Of course, once we guess the hidden password before we exceed the limit, we win the game.
Code:
|
Video:
Game #5: "Tic Tac Toe"
This is the last game in this project and it is a strategy game for two players, X and O, who take turns marking the spaces in a 3×3 grid.
The player who succeeds in placing three of their marks in a diagonal, horizontal, or vertical row is the winner.
Code:
|
Video:
If you have any questions or free conclusions regarding this article, feel free to leave a comment.
However, if you have ideas for further projects or if you have any other questions, please do not hesitate to contact me.
All scripts and their descriptions can be found in my repository on the GitHub platform, where I cordially invite you.
Comments:
0 comments
There is no comment yet.
Add new comment: