WTF!只需一行 Python 代码即可玩 20 几款小游戏

百家 作者:AI100 2022-05-27 20:13:38

作者 |?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



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



好了,这里就不一一列举了,有兴趣的小伙伴可以自己动手试试。

该视频号动态不可引用



往期回顾

介绍Pandas实战中的一些高端玩法


从Python可视化图表中探究王心凌的流量密码


Python 实现 GIF 动图以及视频卡通化


如何用一行Python代码制作一个GUI?


分享

点收藏

点点赞

点在看

关注公众号:拾黑(shiheibook)了解更多

[广告]赞助链接:

四季很好,只要有你,文娱排行榜:https://www.yaopaiming.com/
让资讯触达的更精准有趣:https://www.0xu.cn/

公众号 关注网络尖刀微信公众号
随时掌握互联网精彩
赞助链接