hello everyone , It's children's Day , Although bald programmers have no hair , But childlike innocence is always there , Share a private one today GitHub project ——free-python-games, One line of code can be used Python Develop small games to play happily !

Installation and use

Of course, the installation is also very simple. One line of code is OK

pip install freegames

Because all games in this project are based on Python Built in module Turtle make , So there is not much dependence , Installation will not be difficult .

After installation, we can use python -m freegames list To view the list of all games

Gluttonous snake

Now we can start relevant games with one line of code , For example, greedy snakes snake

python -m freegames.snake

I don't think we need to explain too much about snake playing , Using the keyboard ⬆️⬇️⬅️➡️ Can be manipulated

Bean eater

Bean eaters should have heard of them before , Use the following code to start a game similar to pac man python -m freegames.pacman

Flappy

Flappy This game is very popular as before Flappy bird Very similar

Just change the game name to start python -m freegames.flappy

maze

This game should not be introduced , Find out the corresponding path out of the maze python -m freegames.maze

Tic Tac Toe

I bet you've played this game , Click on the screen to place a X or O, When three identical patterns are in a straight line, you win python3 -m freegames.tictactoe

View source code

There are more games here, so I won't introduce them one by one ,Turtle We are not strangers , So when we play games, we should think about how developers implement it . Use the following code to generate the source code of the corresponding game in the current directory python3
-m freegames copy snake

After execution, there will be one more desktop snake.py, Open it to view the corresponding logic of the game

Now we can learn the source code and modify it to achieve more functions and gameplay , Hurry up and try !

Technology