Click to see the descriptions in Persian language
Notice: Each section has a README file in English and Farsi in its respective file. By clicking on the links of each section, you can learn more in-depth information about the code and its function.
This code implements a guessing game called "Bulls and Cows," where the player must guess a 4-digit number. For each guess, the program provides feedback in the form of "Bulls" and "Cows"; "Bulls" represent digits that are correct in both position and value, while "Cows" indicate digits that are in the secret number but in the wrong position. The generated number has no repeated digits and falls between 1000 and 9999. The player continues to guess until they either identify the correct number or run out of attempts. If the player successfully guesses the number, a success message is displayed; otherwise, the hidden number is revealed.
To view the file English README.md and Persian README.md The full code of the game Python Code.
Tic-Tac-Toe, also known as Noughts and Crosses, is a simple and popular game usually played between two players. The game is played on a 3x3 grid. One player chooses the X symbol, and the other chooses O. The objective of the game is to place three of one's own symbols in a row (either horizontally, vertically, or diagonally). The first player starts by placing their symbol in one of the grid cells. Then it is the second player's turn. This process continues until one player gets three symbols in a row, column, or diagonal, winning the game. If all cells are filled and no player has won, the game ends in a draw. There are specific strategies to win. Placing a symbol in the center of the grid increases the chances of winning. Additionally, if an opponent is close to winning, it's essential to block their move by placing a symbol in the right cell. This game's simplicity and lack of special equipment make it appealing to people of all ages.
To view the file English README.md and Persian README.md The full code of the game Python Code.
The game "Rock, Paper, Scissors" is one of the oldest and simplest two-player games, where each player must simultaneously choose one of three moves: "rock," "paper," or "scissors." The rules are simple: rock beats scissors, scissors cut paper, and paper covers rock. If both players choose the same move, the game is a tie, and no one wins. Due to its straightforward rules and the need for minimal equipment, this game is widely popular and is often used for quick decision-making. The game is also interesting from a psychological perspective, as players sometimes try to guess their opponent's pattern and choose their moves accordingly. Known by different names in various cultures, this game even has formal competitions in some countries. In the modern era, it has made its way into computer programs and apps, with online versions allowing players to compete against AI or other players.
To view the file English README.md and Persian README.md The full code of the game Python Code.
This code implements a number-guessing game where the user must guess a number between 1 and 100. First, the user's name is requested, and then an initial guess is taken. A random number is generated as the correct answer. A loop runs until the user’s guess matches the correct answer, and in each step, feedback is provided on whether the guess is higher or lower than the answer. Once the correct guess is made, the total number of attempts and a congratulatory message are displayed.
To view the file English README.md and Persian README.md The full code of the game Python Code.
The Pygame library is initialized, and colors, screen size, and game speed are set. A game window is created with a specified size and the title "Snake Game" is assigned. Functions are defined to draw the snake, display messages, and render the grid on the screen. Variables are initialized, including the snake's initial position and food placement, and the main game loop starts. In this loop, user inputs (such as arrow key presses) are processed to control the snake's movement. If the snake collides with the wall or itself, the game stops, and a "Game Over" screen is displayed. The snake's position, food, and score are updated, and all elements are redrawn on the screen. The game's speed is controlled, and the game exits if the window is closed.
To view the file English README.md and Persian README.md The full code of the game Python Code.
