https://github.com/zrr1999/bonegame
https://github.com/zrr1999/bonegame
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/zrr1999/bonegame
- Owner: zrr1999
- License: gpl-3.0
- Created: 2020-10-11T02:16:50.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-12-05T05:13:28.000Z (over 2 years ago)
- Last Synced: 2025-10-07T08:43:51.873Z (9 months ago)
- Language: Python
- Size: 43.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BoneGame
[](https://github.com/RichardLitt/standard-readme)
本代码库提供了制作小游戏的基本工具,实现了若干小游戏,
并利用OpenGL实现渲染。
## 安装[](https://pepy.tech/project/bone-games)
这个项目使用 [Python](https://www.python.org/downloads/) 开发,请确保你本地安装了它。
使用PyPI安装。
```sh
$ pip install bone-games
```
本地安装。
```sh
$ pip install .
```
## 使用说明
使用时,您可以直接引入GoBang类并实例化。
```python
from bonegame import GoBang
game = GoBang()
```
你可以调用game对象的所有方法,大部分方法支持函数式编程。
```python
game.down(0, (1, 1)) # 下子
game.render() # 显示
```
## 代码示例
如下代码可以直接运行,点击屏幕轮流进行下棋。
```python
from bonegame import GoBang
import cv2
HEIGHT, WIDTH = 640, 640
SIZE = 7
WIN_NAME = "GoBang"
game = GoBang(SIZE, HEIGHT, WIDTH)
cv2.namedWindow(WIN_NAME, cv2.WINDOW_AUTOSIZE)
cv2.setMouseCallback(WIN_NAME, game.mouse_event) # 创建默认鼠标事件(轮流下子)
while True:
game.render(WIN_NAME)
key = cv2.waitKey(1)
if key == ord('q'):
break
```
## 开发功能
- [x] 五子棋
- [x] 多人五子棋
- [ ] 优化逻辑,减少类依赖关系
- [ ] 更好的多人五子棋接口
- [ ] 中国象棋
- [ ] 围棋
- [ ] 决策树
- [ ] 添加详细注释(代码文档)
- [ ] 整合贪吃蛇
- [ ] 增加OpenGL等其他渲染方式
- [ ] 使用Taichi或Torch加速计算部分
## 更新日志
- (2020.10.27) v0.1.2
- 鼠标事件、图形渲染等全部移植到OpenGL。
- 增加了一个调用dll的五子棋例子。
- (2020.10.11) v0.1.1
- 将鼠标事件移入GoBang类。
- (2020.10.10) v0.1.0
- 实现了五子棋并提供了接口允许开发者进行扩展。
## 维护者
[@詹荣瑞](https://github.com/tczrr1999)
## 如何贡献
非常欢迎你的加入 或者提交一个 Pull Request。
### 贡献者
感谢以下参与项目的人:
## 使用许可
禁止将本辅助库及衍生品上传到百度网盘。
[GNU](LICENSE) © Rongrui Zhan