头图

Today I share an interesting github project: https://github.com/kingser/free-python-games , through this project, we can play 20 small games with just one line of code. Let's take a look at it in detail.

Install

First, let's install. The installation is very simple, just one line of command: pip install freegames .

use

After the installation is complete, we use the command: python -m freegames list to view the list of playable games, as shown below:

 ant
bagels
bounce
cannon
connect
crypto
fidget
flappy
guess
life
madlibs
maze
memory
minesweeper
pacman
paint
pong
simonsays
snake
tictactoe
tiles
tron

Use the command to run (start) the mini game: python -m freegames.游戏名 , let's take a look at the example below.

 python -m freegames.snake

 python -m freegames.pacman

 python -m freegames.flappy

 python -m freegames.connect

 python -m freegames.cannon

 python -m freegames.memory

 python -m freegames.pong

 python -m freegames.simonsays

 python -m freegames.tictactoe

 python -m freegames.tiles

 python -m freegames.tron

 python -m freegames.life

 python -m freegames.maze

 python -m freegames.fidget

Well, I won't list them all here, and interested friends can try it out for themselves.


Python小二
180 声望415 粉丝