Py学习  »  Python

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

AI科技大本营 • 3 年前 • 255 次点击  

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


分享

点收藏

点点赞

点在看

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/135040
 
255 次点击