随笔分类 -  Python

使用python和pygame绘制繁花曲线
摘要:前段时间看了一期《最强大脑》,里面展示了各种繁花曲线组合成的非常美丽的图形,一时心血来潮,想尝试自己用代码绘制繁花曲线,想怎么组合就怎么组合。 真实的繁花曲线使用一种称为繁花曲线规的小玩意绘制,繁花曲线规由相互契合的大小两个圆组成,用笔插在小圆上的一个孔中,紧贴大圆的内壁滚动,就可以绘制出漂亮的图案 阅读全文
posted @ 2018-01-28 16:30 Jinglelove 阅读(11231) 评论(1) 推荐(2)
经典方块游戏-俄罗斯方块
摘要:1、俄罗斯方块类定义 1 # -*- coding: utf-8 -*- 2 3 from base import Base 4 from point import Point 5 from utils import * 6 import random 7 8 class Tetris(Base): 阅读全文
posted @ 2018-01-05 17:59 Jinglelove 阅读(405) 评论(0) 推荐(0)
经典方块游戏-贪吃蛇
摘要:1、贪吃蛇类定义 1 # -*- coding: utf-8 -*- 2 3 from base import Base 4 from point import Point 5 from utils import * 6 import random 7 8 class Snake(Base): 9 阅读全文
posted @ 2018-01-05 17:58 Jinglelove 阅读(252) 评论(0) 推荐(0)
经典方块游戏-基础
摘要:1、游戏中使用的 “点” 的定义 1 # -*- coding: utf-8 -*- 2 3 class Point: 4 5 def __init__(self, x=0, y=0): 6 self.x, self.y = x, y 7 8 def __eq__(self, another): 9 阅读全文
posted @ 2018-01-05 17:55 Jinglelove 阅读(261) 评论(0) 推荐(0)