CPGames中文文档

项目声明


本项目仅供python爱好者学习使用, 禁止用于商业用途, 游戏中的图片、音频和字体文件源于网络, 侵歉删。

安装CPGames

环境配置

  • 操作系统: Linux or macOS or Windows

  • Python版本: Python3.6+

Whl文件安装(推荐)

在终端运行如下命令即可(请保证python在环境变量中):

wget https://github.com/CharlesPikachu/Games/releases/download/v0.1.2/cpgames-0.1.2-py3-none-any.whl
pip install cpgames-0.1.2-py3-none-any.whl

PIP安装(推荐)

在终端运行如下命令即可(请保证python在环境变量中):

pip install cpgames --upgrade

源代码安装

1.在线安装

运行如下命令即可在线安装:

pip install git+https://github.com/CharlesPikachu/Games.git@master

2.离线安装

利用如下命令下载Games源代码到本地:

git clone https://github.com/CharlesPikachu/Games.git

接着, 切到Games目录下:

cd Games

最后运行如下命令进行安装:

python setup.py install

快速开始

已经支持的小游戏

兔子和獾(射击游戏)

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('bunnybadger')

仿八分音符的声控小游戏

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('voicecontrolpikachu')

拼图小游戏

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('puzzlepieces')

滑雪游戏

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('ski')

经典坦克大战小游戏

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('tankwar')

飞扬的小鸟小游戏

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('flappybird')

仿谷歌浏览器小恐龙游戏

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('trexrush')

塔防游戏

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('towerdefense')

接金币小游戏

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('catchcoins')

飞机大战

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('aircraftwar')

俄罗斯方块

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('tetris')

推箱子

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('sokoban')

外星人入侵小游戏

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('alieninvasion')

吃豆人小游戏

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('pacman')

消消乐

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('gemgem')

24点小游戏

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('twentyfourpoint')

乒乓球小游戏

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('pingpong')

打砖块小游戏

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('breakoutclone')

炸弹人小游戏

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('bomberman')

走迷宫小游戏

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('maze')

打地鼠

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('whacamole')

五子棋小游戏

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('gobang')

2048小游戏

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('twozerofoureight')

贪吃蛇小游戏

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('greedysnake')

扫雷小游戏

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('minesweeper')

愤怒的小鸟

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('angrybirds')

记忆翻牌小游戏

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('flipcardbymemory')

魔塔小游戏

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('magictower')

热血足球小游戏

1.公众号文章链接

点击查看

2.调用示例代码

from cpgames import cpgames

game_client = cpgames.CPGames()
game_client.execute('bloodfootball')

随机运行一个小游戏

代码实现如下:

import random
from cpgames import cpgames

game_client = cpgames.CPGames()
all_supports = game_client.getallsupported()
game_client.execute(random.choice(list(all_supports.values())))

开发日志

2022-01-08

  • 版本号: v0.1.0,

  • 更新内容: 集成了27款小游戏。

2022-03-21

  • 版本号: v0.1.1,

  • 更新内容: 集成了半成品魔塔小游戏, 修复了Linux下运行存在的字体导入BUG。

2022-04-25

  • 版本号: v0.1.2,

  • 更新内容: 添加了热血足球小游戏。

项目推荐

关于作者

学生党, 主要研究方向是计算机视觉, 顺便对信息安全感兴趣。

我的个人微信公众号是: Charles_pikachu (欢迎搜索关注,或者搜”Charles的皮卡丘”)

我的Github账号是: https://github.com/CharlesPikachu ((欢迎搜索关注))

我的知乎账号是: https://www.zhihu.com/people/charles_pikachu (欢迎搜索关注)

我的B站账号是: https://space.bilibili.com/406756145 (欢迎搜索关注)

个人邮箱: charlesblwx@gmail.com