
Lv.1
人机?定教他有来无回
签名:我是FW
在 【一个小游戏】把你自认为最妙的一个句子,用输入法打首字母看看是什么。同时把原句发出来! 中回复
龙门市区签完了百万美元kg
两秒17枪,我lbw没用开挂()
2022-04-07T17:22:34 点赞:0
在 开始研究算法 中回复
啊哈哈哈,全能你的饭碗我抢走啦啊哈哈哈或或(
(为了方便,这里的兵我用的是‘zero’方块))
world.onPlayerJoin(({entity})=>{
entity.player.canFly=true;
})
const dir = [new Box3Vector3(-1,0,0),new Box3Vector3(0,0,-1),new Box3Vector3(0,0,1),new Box3Vector3(1,0,0) ];
var voxel=voxels.id('zero')
var a=[];
a[voxels.id('grass')] = 1;
a[voxels.id('green_leaf')]=2
a[voxels.id('stone')]=4
a[voxels.id('water')] = 114514
async function bfs(x,y,z){
let queue = [new Box3Vector3(0,0,0),new Box3Vector3(0,0,0),new Box3Vector3(0,0,0)];
queue.pop();
queue.pop();
queue.pop();
let stpq=[0,0,0];
stpq.pop();
stpq.pop();
queue.push(new Box3Vector3(x,y,z));
world.say(x + ' ' + y +' ' + z);
while(queue.length > 0){
let now = queue[0];
queue.shift();
let stp = stpq[0];
stpq.shift();
for(let i = 0; i < 4; i++){
let nowx = now.x+dir[i].x;
let nowy = now.y+dir[i].y;
let nowz = now.z+dir[i].z;
if(voxels.getVoxelId(nowx,nowy,nowz) == voxels.id('air')){
if(stp+a[voxels.getVoxelId(nowx,nowy-1,nowz)] < 9){
queue.push(new Box3Vector3(nowx,nowy,nowz));
stpq.push(stp+a[voxels.getVoxelId(nowx,nowy-1,nowz)]);
voxels.setVoxel(nowx,nowy,nowz,'glass')
}
}
}
await sleep(1);
}
console.log('finishbfs');
}
for(let i =0; i < 128; i++){
for(let k = 0; k < 128; k++){
if(voxels.getVoxelId(i,9,k) == voxel){
bfs(i,9,k);
break;
}
}
}2022-04-07T22:07:21 点赞:2