最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

Python編程控制我的世界 04 讀取文件創(chuàng)建迷宮

2023-07-29 17:10 作者:xiaotiaotiao2011  | 我要投稿

csv文件

1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1

1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,1,0,0,0,1,1,1,1,1,1,1

1,1,1,1,0,1,1,1,1,1,0,1,1,0,1,1,1,0,1,1,0,1,0,1,1,1,1,1,1,1

1,0,0,0,0,1,0,0,0,0,0,1,1,0,1,0,0,0,1,1,0,1,0,1,1,1,1,1,1,1

1,0,1,1,1,1,0,1,1,1,0,1,1,0,1,0,1,1,1,0,0,1,0,1,1,1,1,1,1,1

1,0,0,0,0,0,0,1,1,1,0,1,1,0,1,0,1,1,1,0,1,1,0,1,1,1,1,1,1,1

1,1,1,1,1,1,0,1,1,1,0,1,1,0,1,0,0,0,0,0,1,1,0,1,1,1,1,1,1,1

1,0,0,0,0,1,0,1,1,1,0,1,1,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1

1,0,1,1,0,1,0,1,1,1,0,1,1,0,0,0,1,1,1,1,0,1,1,0,1,1,1,0,1,1

1,0,1,1,0,1,0,0,0,0,0,1,1,1,1,0,1,1,1,1,0,1,1,0,1,1,1,0,1,1

1,0,1,1,0,1,0,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,1

1,0,1,0,0,1,0,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,0,1,1

1,0,1,0,1,1,0,0,0,1,0,1,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,0,1,1

1,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,1,1,1,0,1,1

1,0,1,1,1,0,1,1,1,1,1,1,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1

1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1

1,1,1,0,1,1,1,0,1,0,1,1,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1

1,1,1,0,1,1,1,0,0,0,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1

1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1

1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1


源碼:

import time

from mcpi.minecraft import Minecraft

import mcpi.block as block

from mcpi.minecraft import CmdPositioner


mc = Minecraft.create()


mc.postToChat("連接成功,開(kāi)始編程")


l_id = mc.getPlayerEntityId("longsimiao")


positioner = CmdPositioner(mc.conn, b"entity")

pos = positioner.getTilePos(l_id)


x = pos.x

y = pos.y

z = pos.z


filename = "迷宮數(shù)據(jù).csv"


f = open(filename, "r")


for line in f.readlines():

print(line)

data = line.split(",")

x = pos.x

for cell in data:

if cell == '0':

mc.setBlock(x, y, z, block.AIR.id)

mc.setBlock(x, y + 1, z, block.AIR.id)

mc.setBlock(x, y - 1, z, block.GRASS.id)

else:

mc.setBlock(x, y, z, block.DIAMOND_BLOCK.id)

mc.setBlock(x, y + 1, z, block.DIAMOND_BLOCK.id)

mc.setBlock(x, y - 1, z, block.GRASS.id)

time.sleep(0.1)

x += 1

z += 1


Python編程控制我的世界 04 讀取文件創(chuàng)建迷宮的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
奈曼旗| 邮箱| 屯昌县| 邵阳县| 敦煌市| 姜堰市| 祁门县| 太仆寺旗| 宜兰市| 屏东市| 克什克腾旗| 都兰县| 邢台县| 临沧市| 宕昌县| 贵德县| 抚宁县| 资阳市| 阆中市| 天全县| 稻城县| 四川省| 孝感市| 栾川县| 青岛市| 赣榆县| 叙永县| 无为县| 巴青县| 灵山县| 固镇县| 会东县| 三台县| 蒙城县| 定安县| 贺州市| 常熟市| 十堰市| 太保市| 宁津县| 普洱|