本帖最后由 zhoutk 于 2021-6-10 09:41 编辑
背景
规划- 项目结构
- 界面设计
- block类,最小方块定义
- tetris类,俄罗斯方块定义
- tetris方块的移动与旋转
- game类,游戏流程控制
- 完成游戏基本功能,支持游戏暂停
- 定时驱动与线程同步问题
- 设计通用数据库操作封装,首先使用sqlite3
- 设计ORM实现自动查询
- 存储历史数据,实现游戏回放
- 简单AI
- 机器学习,改进AI
设计思路该游戏尽量不使用第三方库,主要注重算法,因此界面库选择python内置的tkinter。设计思想也采用传统的方式,用一个二维数组来控制游戏空间,类似迷宫的方式。选择这种方式有一个好处是,游戏的数据直观存在,容易获取。
项目地址
https://gitee.com/zhoutk/ptetris
或
https://github.com/zhoutk/ptetris
运行方法
1. install python3, git
2. git clone https://gitee.com/zhoutk/ptetris (or download and unzip source code)
3. cd ptetris4. python3
tetrisThis project surpport windows, linux, macOs
on linux, you must install tkinter first, use this command: sudo apt install python3-tk相关项目
已经实现了C++版,项目地址:
https://gitee.com/zhoutk/qtetris
效果图
|