绘制迷宫图案,绘制迷宫,width,height
文章由Byrx.net分享于2019-03-23 08:03:08
绘制迷宫图案,绘制迷宫,width,height
width,height=100,50 #宽高matrix=[["" for x in range(width)] for y in range(height)]DDD={(0,0):list("┌"),(0,1):list("│└├"),(1,0):list("─┐┬"),(1,1):list("┘┤┴┼")}EL="│┐┘┤" #不能接左UL="─└┘┴" #不能连上import randomfor c in range(height): for r in range(width): UUU=0 if c==0 or matrix[c-1][r] in UL else 1 LLL=0 if r==0 or matrix[c][r-1] in EL else 1 matrix[c][r]=random.choice(DDD[(LLL,UUU)]) txt="\\n".join(["".join(x) for x in matrix])print(txt)from time import sleepsleep(100)#该片段来自于http://byrx.net
相关内容
- 提取 双色球 每期信息,提取双色球信息,#!/usr/bin/p
- Python 生成随机密码,python生成,import strin
- Python max函数,pythonmax函数,max函数是Python
- 使用PyQt4的QtWebKit对整个网页截图,pyqt4qtwebkit截图,#-*
- Python备份脚本——版本一(Windows),python脚本,参照pytho
- itertools.combinations代码分析,,def combinat
- python查找目录下指定扩展名的文件,python扩展名,impor
- python连接mongodb的基本代码,python连接mongodb,from pymongo
- python对数组进行反转的代码,python数组反转,arr = [1,2,
- python通过函数属性实现全局变量,python全局变量,def a
评论关闭