作者 | Python小二
来源 | Python小二
今天分享一个有趣的 github 项目:https://github.com/kingser/free-python-games
,通过该项目,我们只需一行代码即可玩 20 几款小游戏,下面具体来看一下。
安装
首先,我们进行安装,安装很简单,只需一行命令即可:pip install freegames
。
使用
安装完成之后,我们使用命令:python -m freegames list
查看一下可玩的游戏列表,如下所示:
ant
bagels
bounce
cannon
connect
crypto
fidget
flappy
guess
life
madlibs
maze
memory
minesweeper
pacman
paint
pong
simonsays
snake
tictactoe
tiles
tron
小游戏的运行(启动)使用命令:python -m freegames.游戏名
,下面通过示例具体看一下。
python -m freegames.snake
![2ccdfd14287c270b17abe81eb10003e7.gif](https://img-blog.csdnimg.cn/img_convert/2ccdfd14287c270b17abe81eb10003e7.gif)
python -m freegames.pacman
![690d9d1369bf44acbdcdd0a2ba47d8f5.gif](https://img-blog.csdnimg.cn/img_convert/690d9d1369bf44acbdcdd0a2ba47d8f5.gif)
python -m freegames.flappy
![6f20e22257ad751846896a4dd061f54f.gif](https://img-blog.csdnimg.cn/img_convert/6f20e22257ad751846896a4dd061f54f.gif)
python -m freegames.connect
![bfd3efe91e51b4a0a527e692b5753395.gif](https://img-blog.csdnimg.cn/img_convert/bfd3efe91e51b4a0a527e692b5753395.gif)
python -m freegames.cannon
![70f72d175c681b3d360b9c6bab55beb6.gif](https://img-blog.csdnimg.cn/img_convert/70f72d175c681b3d360b9c6bab55beb6.gif)
python -m freegames.memory
![9dc08a30a9590c5ee543de6f2bc1f097.gif](https://img-blog.csdnimg.cn/img_convert/9dc08a30a9590c5ee543de6f2bc1f097.gif)
python -m freegames.pong
![9db47f615c33009dae3af713811c1d4f.gif](https://img-blog.csdnimg.cn/img_convert/9db47f615c33009dae3af713811c1d4f.gif)
python -m freegames.simonsays
![c9bd11f80ab0f780affcd845323ce72f.gif](https://img-blog.csdnimg.cn/img_convert/c9bd11f80ab0f780affcd845323ce72f.gif)
python -m freegames.tictactoe
![a9ba8a5a2cdce9b79bb1aa5d262d9eae.gif](https://img-blog.csdnimg.cn/img_convert/a9ba8a5a2cdce9b79bb1aa5d262d9eae.gif)
python -m freegames.tiles
![5c3037d35da8d61cfac64a83da84ba98.gif](https://img-blog.csdnimg.cn/img_convert/5c3037d35da8d61cfac64a83da84ba98.gif)
python -m freegames.tron
![a7661453a8a88f0cd1093fea20730349.gif](https://img-blog.csdnimg.cn/img_convert/a7661453a8a88f0cd1093fea20730349.gif)
python -m freegames.life
![2c91054dc77ccb9089b262e484b49c19.gif](https://img-blog.csdnimg.cn/img_convert/2c91054dc77ccb9089b262e484b49c19.gif)
python -m freegames.maze
![fdd41bf6b9aa3b8cd5f5a640e1e2b768.gif](https://img-blog.csdnimg.cn/img_convert/fdd41bf6b9aa3b8cd5f5a640e1e2b768.gif)
python -m freegames.fidget
![a016c0933755990fd47f7a7067895e17.gif](https://img-blog.csdnimg.cn/img_convert/a016c0933755990fd47f7a7067895e17.gif)
好了,这里就不一一列举了,有兴趣的小伙伴可以自己动手试试。
该视频号动态不可引用
往期回顾
分享
点收藏
点点赞
点在看