python小项目练习我的Python自学之路Python

python2048游戏设计

2017-01-08  本文已影响175人  happyte

先添上最终完成效果图

Github链接

https://github.com/happyte/2048, 这个是2048的代码仓库,希望大家指出不足之处。

2048设计思想

基础类

   lastmatrix = matrix.copy()
   m,n = matrix.shape
   if matrix.min() == 0 and (matrix!=lastmatrix).any():
       #往矩阵添加随机数2或者4
 下面贴上整个函数的代码

继承类

游戏初始化

主函数

上一篇 下一篇

猜你喜欢

热点阅读