跳到正文

剪贴板

剪贴板 9362bopf

原文
剪贴板信息

剪贴板信息

收录
更新
代码
C++
//Minecraft Alpha 2.2
//Made By CODE_MOSS

#include<bits/stdc++.h>
using namespace std;

//world
int world[128][512][512],rea_wor[3][512][512],borin_wor[3][512][512],blo_arr[36][2],blo_num[24];
int x=1,y=256,z=256,life=20,num_of_air=10,mode=0,TIM_LIF;
int difficulty,jum_sel,game_state;
int fal_hig,sta_i_wat_sec;
string arc_nam;
int exp_lev=0;
double exp_poi=0;

//update
int tck;
struct U{
	int tck,x,y,z,k;
};
bool operator > (const U a,const U b){
	return a.k>b.k;
}
priority_queue<U,vector<U>,greater<U>>upd;

//synthesis
int recipes[64][9]={{1,5,0,0,0,0,4,15,0},{2,15,0,0,0,0,4,16,0},{2,16,3,15,0,0,1,17,1},{4,11,0,0,0,0,1,2,0},{2,16,3,2,0,0,1,18,1},{2,16,3,7,0,0,1,19,1},{2,16,3,8,0,0,1,20,1},{2,16,3,10,0,0,1,21,1},{4,15,0,0,0,0,1,22,0},{2,1,2,11,0,0,4,1,0}};

//block and item
char block[2][64][32]={
{"","soil","stone","water","lava","wood","leaves","iron","gold","bedrock","diamond","sand","flint","TNT","sapling","board","wooden_trick","wooden_pickaxe","stone_pickaxe","iron_pickaxe","golden_pickaxe","diamond_pickaxe","crafting_table"},
{"","\b泥土","\b石头","\b水","\b岩浆","\b原木","\b树叶","\b铁锭","\b金锭","\b基岩","\b钻石","\b沙子","\b燧石","TNT","\b树苗","\b木板","\b木棍","\b木镐","\b石镐","\b铁镐","\b金镐","\b钻石镐","\b工作台"}
};//方块标签
int hardness[64]={0,0,1,-1,-1,0,0,2,3,2147483647,3,0,0,0,0,0,0,1,2,3,3,4,0};//方块硬度等级
int durable[64]={0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,60,132,251,34,1562,0};//方块可否堆叠&耐久
double val[64]={0,0.1,0.4,0,0,0.3,0,0.8,1.2,0,1.6,0.1,0.3,0,0.2,0.1,0.06,1,1.5,3,4,5.4,1.2};
int selected=0;

//language
int L=0,l_op;

bool determine(int x1,int y1,int z1){
	return world[x1][y1][z1]==0 || world[x1][y1][z1]==3 || world[x1][y1][z1]==4;
}

int distance(int x1,int y1,int z1,int x2,int y2,int z2){
	return (int)sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)+(z1-z2)*(z1-z2));
}

void explosion(int x1,int y1,int z1){
	for(int i=(x1+126)%128;i<=(x1+2)%128;i++){
		for(int j =(y1+510)%512;j<=(y1+2)%512;j++){
			for(int k=(z1+510)%512;k<=(z1+2)%512;k++){
				if(world[i][j][k]==13)upd.push((U){tck+24,i,j,k,0});
				world[i][j][k]=0;
			}
		}
	}
	life-=(int)pow(difficulty*1.9,6-distance(x1,y1,z1,x,y,z));
	if((int)(6-distance(x1,y1,z1,x,y,z)>0))TIM_LIF=0;
	return;
}

void make_tree(int x1,int y1,int z1){
	for(int j=x1-5;j<=x1-3;j++){
		for(int k=y1-2;k<=y1+2;k++){
			for(int l=z1-1;l<=z1+1;l++){
				if(determine(j,k,l))world[j][k][l]=6;
			}
		}
		for(int k=y1-1;k<=y1+1;k++){
			for(int l=z1-2;l<=z1+2;l++){
				if(determine(j,k,l))world[j][k][l]=6;
			}
		}
	}
	for(int j=y1-1;j<=y1+1;j++){
		for(int k=z1-1;k<=z1+1;k++){
			if(determine(x1-6,j,k))world[x1-6][j][k]=6;
		}
	}
	for(int j=x1-4;j<=x1;j++){
		world[j][y1][z1]=5;
	}
	return;
}

void make_world(){
	for(int i=0;i<512;i++){
		for(int j=0;j<512;j++){
			rea_wor[0][i][j]=rand()%12+57;
			rea_wor[1][i][j]=rand()%24+81;
			rea_wor[2][i][j]=rand()%40+87;
		}
    }
	for(int i=1;i<511;i++){
		for(int j=1;j<511;j++){
			borin_wor[0][i][j]=(rea_wor[0][i][j]+rea_wor[0][i-1][j]+rea_wor[0][i+1][j]+rea_wor[0][i][j-1]+rea_wor[0][i][j+1]+rea_wor[0][i-1][j-1]+rea_wor[0][i+1][j-1]+rea_wor[0][i+1][j+1]+rea_wor[0][i-1][j+1])/9;
			borin_wor[1][i][j]=(rea_wor[1][i][j]+rea_wor[1][i-1][j]+rea_wor[1][i+1][j]+rea_wor[1][i][j-1]+rea_wor[1][i][j+1]+rea_wor[1][i-1][j-1]+rea_wor[1][i+1][j-1]+rea_wor[1][i+1][j+1]+rea_wor[1][i-1][j+1])/9;
			borin_wor[2][i][j]=(rea_wor[2][i][j]+rea_wor[2][i-1][j]+rea_wor[2][i+1][j]+rea_wor[2][i][j-1]+rea_wor[2][i][j+1]+rea_wor[2][i-1][j-1]+rea_wor[2][i+1][j-1]+rea_wor[2][i+1][j+1]+rea_wor[2][i-1][j+1])/9;
		}
	}
	for(int i=0;i<24;i++){
		int yr,zr;
		do{
			yr=rand()%512;
		    zr=rand()%512;
		}while(borin_wor[0][yr][zr]<=17);
		for(int k=rand()%12*3+10;k>=1;k-=3){
			for(int i=(yr-k+512)%512;i<(yr+k)%512;i++){
			    for(int j=(zr-k+512)%512;j<(zr+k)%512;j++){
				    borin_wor[0][i][j]++;
			    }
		    }
		}
	}
	for(int i=0;i<12;i++){
		int yr,zr;
		do{
			yr=rand()%512;
		    zr=rand()%512;
		}while(borin_wor[0][yr][zr]>=15);
		for(int k=rand()%10*3+10;k>=1;k-=3){
			for(int i=(yr-k+512)%512;i<(yr+k)%512;i++){
			    for(int j=(zr-k+512)%512;j<(zr+k)%512;j++){
				    borin_wor[0][i][j]--;
			    }
		    }
		}
	}
	for(int j=0;j<512;j++){
		for(int k=0;k<512;k++){
			for(int i=63;i<borin_wor[0][j][k];i++)world[i][j][k]=3;
			for(int i=borin_wor[0][j][k];i<borin_wor[1][j][k];i++)world[i][j][k]=2;
			for(int i=borin_wor[2][j][k];i<128;i++)world[i][j][k]=2;
			for(int i=borin_wor[0][j][k];i<borin_wor[0][j][k]+3;i++)world[i][j][k]=1;
			for(int i=0;i<127;i++){
				if(world[i][j][k]==2 && rand()%6==0)world[i][j][k]=7;
				if(world[i][j][k]==2 && rand()%18==0)world[i][j][k]=8;
				if(world[i][j][k]==2 && rand()%36==0)world[i][j][k]=10;
			}
			for(int i=122;i<=124;i++)world[i][j][k]=4;
			for(int i=125;i<=127;i++)world[i][j][k]=9;
		}
	}
	for(int i=0;i<24;i++){
		int xr,yr,zr;
		do{
			xr=rand()%16+50;
		    yr=rand()%512;
		    zr=rand()%512;
		}while(world[xr][yr][zr]==3 || world[xr][yr][zr]==0);
		for(int i=xr-6;i<=xr+6;i++){
			for(int j=(yr-(rand()%12+5)+512)%512;j<=(yr+(rand()%12+5))%512;j++){
				for(int k=(zr-(rand()%12+5)+512)%512;k<=(zr+(rand()%12+5))%512;k++){
					if(world[i][j][k]==1)world[i][j][k]=11;
					if(world[i][j][k]==3)world[i][j][k]=11;
				}
			}
		}
		for(int i=xr-6;i<=xr+6;i++){
			for(int j=(yr-(rand()%20+5)+512)%512;j<=(yr+(rand()%20+5))%512;j++){
				for(int k=(zr-(rand()%20+5)+512)%512;k<=(zr+(rand()%20+5))%512;k++){
					if(world[i][j][k]==1 && rand()%4!=0)world[i][j][k]=11;
					if(world[i][j][k]==3)world[i][j][k]=11;
				}
			}
		}
	}
	for(int i=0;i<512;i++){
		int xr=48,yr=0,zr=0;
		while(world[xr][yr][zr]!=1 || world[xr-1][yr][zr]!=0){
			xr=rand()%16+48;
		    yr=rand()%480+16;
		    zr=rand()%480+16;
		}
		make_tree(xr,yr,zr);
	}
	return;
}

void show_world(){
	printf("\n");
	for(int i=(y+496)%512;i!=(y+16)%512;i++,i%=512){
		for(int j=(z+496)%512;j!=(z+16)%512;j++,j%=512){
			if(i==y&&j==z)printf("A");
			else if(world[x][i][j]!=0 && world[x][i][j]!=3)printf(" "); //不可行走的位置
			else if(world[x+1][i][j]==1)printf("."); //草方块
			else if(world[x+1][i][j]==2)printf(","); //圆石
			else if(world[x+1][i][j]==3)printf("~"); //水
			else if(world[x+1][i][j]==4)printf("m"); //岩浆
			else if(world[x+1][i][j]==5)printf("|"); //原木
			else if(world[x+1][i][j]==6)printf("*"); //树叶
			else if(world[x+1][i][j]==7)printf("\""); //铁矿石
			else if(world[x+1][i][j]==8)printf("'"); //金矿石
			else if(world[x+1][i][j]==9)printf("+"); //基岩
			else if(world[x+1][i][j]==10)printf("%"); //钻石矿石
			else if(world[x+1][i][j]==11)printf("!"); //沙子
			else if(world[x+1][i][j]==13)printf("t"); //TNT
			else if(world[x+1][i][j]==14)printf("^"); //树苗
			else if(world[x+1][i][j]==15)printf("="); //木板
			else if(world[x+1][i][j]==22)printf("#"); //木板
			else if(world[x+1][i][j]==0)printf(" "); //虚空
		}
		printf("\n");
	}
	return;
}

void show_knapsack(int opt){
	int num_of_blocks=27*opt+9;
	if(L)cout<<endl<<"\b你的物品栏:";
	else printf("\nYou Have:");
	for(int i=0;i<num_of_blocks;i++){
		if(opt==1 && i%6==0)printf("\n");
		if(blo_arr[i][0]==0 || blo_arr[i][1]==0){
			blo_arr[i][0]=0;
			blo_arr[i][1]=0;
			continue;
		}
		printf("  %d: %d ",i,blo_arr[i][1]);
		if(L)cout<<block[1][blo_arr[i][0]]<<"   ";
		else printf("%s   ",block[0][blo_arr[i][0]]);
	}
	return;
}

void reduce(int k,int n){
	if(mode)return;
	int ns=n;
	for(int i=0;i<36;i++){
		if(blo_arr[i][0]==k){
			if(blo_arr[i][1]>=ns)blo_arr[i][1]-=ns,ns=0;
			else ns-=blo_arr[i][1],blo_arr[i][1]=0,blo_arr[i][0]=0;
		}
	}
	return;
}

void increase(int k,int n){
	if(mode)return;
	int ns=n;
	if(durable[k]>1){
		for(int i=0;i<36;i++){
		    if(blo_arr[i][0]==0){
			    blo_arr[i][0]=k;
				blo_arr[i][1]=durable[k];
				ns--;
		    }
		    if(ns==0)return;
	    }
		return;
	}
	for(int i=0;i<36;i++){
		if(blo_arr[i][0]==k){
			if(ns<=64-blo_arr[i][1])blo_arr[i][1]+=ns,ns=0;
			else ns-=64-blo_arr[i][1],blo_arr[i][1]=64;
		}
		if(ns<=0)return;
	}
	for(int i=0;i<36;i++){
		if(blo_arr[i][0]==0){
			if(ns<=64)blo_arr[i][1]=ns,ns=0;
			else ns-=64,blo_arr[i][1]=64;
			blo_arr[i][0]=k;
		}
		if(ns<=0)return;
	}
	return;
}

void synthesize(int opt){
	int itm=0,it1,it2;
	int com_list[64];
	if(L)cout<<"\b你可以合成:"<<endl;
	else printf("You Can Synthesize:\n");
	memset(blo_num,0,sizeof(blo_num));
	for(int i=0;i<36;i++){
		blo_num[blo_arr[i][0]]+=blo_arr[i][1];
	}
	for(int i=0;i<64;i++){
		if(blo_num[recipes[i][1]]>=recipes[i][0] && recipes[i][1]!=0 && blo_num[recipes[i][3]]>=recipes[i][2] && blo_num[recipes[i][5]]>=recipes[i][4] && recipes[i][8]<=opt){
			com_list[itm]=i;
			if(L)cout<<itm<<" \b:用"<<recipes[i][0]<<" "<<block[1][recipes[i][1]]<<" ";
			else printf("%d:%d %s ",itm,recipes[i][0],block[0][recipes[i][1]]);
			if(recipes[i][2]!=0){
				if(L)cout<<recipes[i][2]<<" "<<block[1][recipes[i][3]]<<" ";
				else printf("%d %s ",recipes[i][2],block[0][recipes[i][3]]);
			}
			if(recipes[i][4]!=0){
				if(L)cout<<recipes[i][4]<<" "<<block[1][recipes[i][5]]<<" ";
				else printf("%d %s ",recipes[i][4],block[0][recipes[i][5]]);
			}
			if(L)cout<<"\b可以合成 "<<recipes[i][6]<<" "<<block[1][recipes[i][7]]<<endl;
			else printf("= %d %s\n",recipes[i][6],block[0][recipes[i][7]]);
			itm++;
		}
	}
	scanf("%d %d",&it1,&it2);
	if(blo_num[recipes[com_list[it1]][1]]>=it2*recipes[com_list[it1]][0] && blo_num[recipes[com_list[it1]][3]]>=it2*recipes[com_list[it1]][2] && blo_num[recipes[com_list[it1]][5]]>=it2*recipes[com_list[it1]][4])reduce(recipes[com_list[it1]][1],it2*recipes[com_list[it1]][0]),reduce(recipes[com_list[it1]][3],it2*recipes[com_list[it1]][2]),reduce(recipes[com_list[it1]][5],it2*recipes[com_list[it1]][4]),increase(recipes[com_list[it1]][7],it2*recipes[com_list[it1]][6]);
	return;
}

void del_wor(int if_scd){
	for(int i=1;i<36;i++){
		if(if_scd){
			if(durable[blo_arr[i][0]]>0)exp_poi+=val[blo_arr[i][0]];
		    else exp_poi+=val[blo_arr[i][0]]+=blo_arr[i][1];
		}
		blo_arr[i][0]=0,blo_arr[i][1]=0;
	}
	while(exp_poi>=pow(1.2,exp_lev))exp_poi-=pow(1.2,exp_lev),exp_lev++;
	if(if_scd==0)exp_lev=0,exp_poi=0;
	return;
}

void sav_arc(){
	ofstream ouf;
	ouf.open(arc_nam);
	ouf<<mode<<" "<<difficulty<<" "<<jum_sel<<" "<<exp_lev<<" "<<exp_poi;
	ouf.close();
	if(L)cout<<"\b存档 "<<arc_nam<<"  \b保存成功!\n";
	else cout<<"The Archive "<<arc_nam<<" Is Saved!"<<endl;
	return;
}

void ask_pos(){
	char a;
	int be_kil=0;
	if(L){
		cout<<"\bX坐标:"<<x<<"   \bY坐标:"<<y<<"   \bZ坐标:"<<z;
		if(!mode)cout<<"   \b生命值:"<<life;
	}
	else{
		printf("X:%d  Y:%d  Z:%d    ",x,y,z);
	    if(!mode)printf("LIFE:%d   ",life);
	}
	if(!mode && num_of_air<10){
		if(L)cout<<"   \b氧气值:"<<num_of_air;
		else printf("AIR:%d",num_of_air);
	}
	show_knapsack(0);
	if(L)cout<<"\b\n你选中的物品是:"<<selected;
	else printf("\nYour Selected Item Is : %d",selected);
	if(L)cout<<"\b\n你要";
	else printf("\nWhat Will You Do?\n");
	scanf(" %c",&a);
	if('0'<=a && a<='8')selected=a-48;
	if(a=='A'){
		if(world[x][y][(z+511)%512]==13)upd.push((U){tck+24,x,y,(z+511)%512,0});
		if(determine(x,y,(z+511)%512))z=(z+511)%512;
		else if(jum_sel && determine(x-1,y,(z+511)%512) && determine(x-1,y,z))z=(z+511)%512,x--;
		else if(world[x][y][(z+511)%512]!=9){
			if(hardness[world[x][y][(z+511)%512]]==0 || (hardness[blo_arr[selected][0]]>=hardness[world[x][y][(z+511)%512]] && durable[blo_arr[selected][0]]>0))be_kil=world[x][y][(z+511)%512];
			else be_kil=0;
			if(durable[blo_arr[selected][0]]>1)blo_arr[selected][1]--;
			if(blo_arr[selected][1]==0)blo_arr[selected][0]=0;
			world[x][y][(z+511)%512]=0;
		}
	}
	else if(a=='W'){
		if(world[x][(y+511)%512][z]==13)upd.push((U){tck+24,x,(y+511)%512,z,0});
		if(determine(x,(y+511)%512,z))y=(y+511)%512;
		else if(jum_sel && determine(x-1,(y+511)%512,z) && determine(x-1,y,z))y=(y+511)%512,x--;
		else if(world[x][(y+511)%512][z]!=9){
			if(hardness[world[x][(y+511)%512][z]]==0 || (hardness[blo_arr[selected][0]]>=hardness[world[x][(y+511)%512][z]] && durable[blo_arr[selected][0]]>0))be_kil=world[x][(y+511)%512][z];
			else be_kil=0;
			if(durable[blo_arr[selected][0]]>1)blo_arr[selected][1]--;
			if(blo_arr[selected][1]==0)blo_arr[selected][0]=0;
			world[x][(y+511)%512][z]=0;
		}
	}
	else if(a=='D'){
		if(world[x][y][(z+1)%512]==13)upd.push((U){tck+24,x,y,(z+1)%512,0});
		if(determine(x,y,(z+1)%512))z=(z+1)%512;
		else if(jum_sel && determine(x-1,y,(z+1)%512) && determine(x-1,y,z))z=(z+1)%512,x--;
		else if(world[x][y][(z+1)%512]!=9){
			if(hardness[world[x][y][(z+1)%512]]==0 || (hardness[blo_arr[selected][0]]>=hardness[world[x][y][(z+1)%512]] && durable[blo_arr[selected][0]]>0))be_kil=world[x][y][(z+1)%512];
			else be_kil=0;
			if(durable[blo_arr[selected][0]]>1)blo_arr[selected][1]--;
			if(blo_arr[selected][1]==0)blo_arr[selected][0]=0;
			world[x][y][(z+1)%512]=0;
		}
	}
	else if(a=='S'){
		if(world[x][(y+1)%512][z]==13)upd.push((U){tck+24,x,(y+1)%512,z,0});
		if(determine(x,(y+1)%512,z))y=(y+1)%512;
		else if(jum_sel && determine(x-1,(y+1)%512,z) && determine(x-1,y,z))y=(y+1)%512,x--;
		else if(world[x][(y+1)%512][z]!=9){
			if(hardness[world[x][(y+1)%512][z]]==0 || (hardness[blo_arr[selected][0]]>=hardness[world[x][(y+1)%512][z]] && durable[blo_arr[selected][0]]>0))be_kil=world[x][(y+1)%512][z];
			else be_kil=0;
			if(durable[blo_arr[selected][0]]>1)blo_arr[selected][1]--;
			if(blo_arr[selected][1]==0)blo_arr[selected][0]=0;
			world[x][(y+1)%512][z]=0;
		}
	}
	else if(a=='Q' && x>1){
		if(!determine(x-1,y,z)){
			if(world[x-1][y][z]==13)upd.push((U){tck+24,x-1,y,z,0});
			if(mode)world[x-1][y][z]=0,x--;
			else if(world[x-1][y][z]!=9){
				if(hardness[world[x-1][y][z]]==0 || (hardness[blo_arr[selected][0]]>=hardness[world[x-1][y][z]] && durable[blo_arr[selected][0]]>0))be_kil=world[x-1][y][z];
			    else be_kil=0;
			    if(durable[blo_arr[selected][0]]>1)blo_arr[selected][1]--;
			    if(blo_arr[selected][1]==0)blo_arr[selected][0]=0;
				world[x-1][y][z]=0;
			}
		}
		else{
			if(mode)x--;
			else if(blo_arr[selected][1]>0 && durable[blo_arr[selected][0]]==0){
			    world[x][y][z]=blo_arr[selected][0];
		        x--;
		        blo_arr[selected][1]--;
		        if(blo_arr[selected][1]==0)blo_arr[selected][0]=0;
	        }
		}
	}
	else if(a=='Z' && x<128){
		if(world[x+1][y][z]==13)upd.push((U){tck+24,x+1,y,z,0});
		if(mode)world[x+1][y][z]=0,x++;
		else{
			if(hardness[world[x+1][y][z]]==0 || (hardness[blo_arr[selected][0]]>=hardness[world[x+1][y][z]] && durable[blo_arr[selected][0]]>0))be_kil=world[x+1][y][z];
			else be_kil=0;
			if(durable[blo_arr[selected][0]]>1)blo_arr[selected][1]--;
			if(blo_arr[selected][1]==0)blo_arr[selected][0]=0;
			world[x+1][y][z]=0;
		}
	}
	else if(a=='C'){
		int bunc_blo_list[1200],tmpi=0;
		for(int i=(x+123)%128;i<=(x+5)%128;i++){
			for(int j=(y+507)%512;j<=(y+5)%512;j++){
                for(int k=(z+507)%512;k<=(z+5)%512;k++){
                    if(distance(x,y,z,i,j,k)<=5 && world[i][j][k]==22){
                        bunc_blo_list[tmpi]=22;tmpi++;
					}
			    }
		    }
	    }
	    if(L)cout<<"\b你可以选择:"<<endl;
	    else printf("You Can Choose:\n");
	    for(int i=0;i<tmpi;i++){
	    	if(L)cout<<i<<": "<<block[1][bunc_blo_list[i]]<<endl;
	    	else printf("%d:%s\n",i,block[0][bunc_blo_list[i]]);
		}
		scanf("%d",&tmpi);
		if(bunc_blo_list[tmpi]==22)synthesize(1);
	}
	else if(a=='O'){
		for(int i=(y+456)%512;i<(y+56)%512;i++){
			for(int j=(z+456)%512;j<(z+56)%512;j++){
				if(y==i && z==j)printf("A");
				else{
					int k=1;
				    while(world[k][i][j]==0)k++;
				    if(world[k][i][j]==1)printf(".");
			        else if(world[k][i][j]==2)printf(",");
			        else if(world[k][i][j]==3)printf("~");
			        else if(world[k][i][j]==4)printf("m");
			        else if(world[k][i][j]==5)printf("|");
			        else if(world[k][i][j]==6)printf("*");
			        else if(world[k][i][j]==7)printf("\"");
			        else if(world[k][i][j]==8)printf("'");
			        else if(world[k][i][j]==9)printf("+");
			        else if(world[k][i][j]==10)printf("%");
			        else if(world[k][i][j]==11)printf("!");
			        else if(world[k][i][j]==13)printf("t");
			        else if(world[k][i][j]==14)printf("^");
			        else if(world[k][i][j]==15)printf("=");
			        else if(world[k][i][j]==22)printf("#");
			        else if(world[k][i][j]==0)printf(" ");
				}
			}
			printf("\n");
		}
		if(L)cout<<"\b128*512*512的世界"<<endl<<endl<<endl;
		else printf("128*512*512WORLD\n\n\n");
	}
	else if(a=='I'){
		for(int i=0;i<128;i++){
			printf("%d ",i);
			if(world[i][y][z]==0)printf(" ");
			else if(world[i][y][z]==1)printf(".");
			else if(world[i][y][z]==2)printf(",");
			else if(world[i][y][z]==3)printf("~");
			else if(world[i][y][z]==4)printf("m");
			else if(world[i][y][z]==5)printf("|");
			else if(world[i][y][z]==6)printf("*");
			else if(world[i][y][z]==7)printf("\"");
			else if(world[i][y][z]==8)printf("'");
			else if(world[i][y][z]==9)printf("+");
			else if(world[i][y][z]==10)printf("%");
			else if(world[i][y][z]==11)printf("!");
			else if(world[i][y][z]==13)printf("t");
			else if(world[i][y][z]==14)printf("^");
			else if(world[i][y][z]==15)printf("=");
			else if(world[i][y][z]==22)printf("#");
			else if(world[i][y][z]==0)printf(" ");
			printf("\n");
		}
	}
	else if(a=='U'){
		if(L)cout<<"\b选项:"<<endl<<"\bA:重新选择难度    B:重新选择模式    C:回到游戏    D:退出世界\n";
		else printf("Pause In Progress:\nA:Choose Difficulty Again    B:Exit The Game    C:Go Back To The Game    D:Exit The World\n");
		scanf(" %c",&a);
		if(a=='A'){
			if(L)cout<<"\b选择难度:\nA:和平    B:简单    C:普通    D:困难\n";
	        else printf("Select Difficulty:\nA:Peaceful    B:Easy    C:Normal    D:Difficult\n");
	        scanf(" %c",&a);
		    if(a=='A')difficulty=0;
		    else if(a=='B')difficulty=1;
		    else if(a=='C')difficulty=2;
		    else if(a=='D')difficulty=3;
		}
		if(a=='B'){
			if(L)cout<<"\b选择模式:\nA:生存    B:创造\n";
	        else printf("Select Mode:\nA:Survival    B:Creative\n");
	        scanf(" %c",&a);
	        if(a=='A')mode=0;
	        else if(a=='B')mode=1;
		}
		if(a=='D'){
			game_state=0;
			del_wor(1);
		}
		return;
	}
	else if(a=='E'){
		while(a!='C'){
			if(L)cout<<"\b你的选择:"<<endl<<"\bA:显示背包    B:合成    C:取消"<<endl;
			else printf("Your Choose:\nA: Show Knapsack    B:Synthesis   C:Cancel\n");
			scanf(" %c",&a);
			if(a=='A')while(a!='C'){
				show_knapsack(1);
				if(L)cout<<"\b你的选择:"<<endl<<"\bA:交换物品    B:丢弃物品    C:取消"<<endl;
				else printf("Your Choose:\nA:Exchange    B:Throw Away    c:Cancel\n");
				scanf(" %c",&a);
				if(a=='A'){
					if(L)cout<<endl<<"\b你想要交换哪两个物品?"<<endl;
				    else printf("\nWhich Two Items Do You Want To Exchange In Your Backpack?\n");
				    int it1,it2;
					scanf("%d %d",&it1,&it2);
					it1%=36;
					it2%=36;
				    swap(blo_arr[it1][0],blo_arr[it2][0]),swap(blo_arr[it1][1],blo_arr[it2][1]);
				}
				else if(a=='B'){
					if(L)cout<<endl<<"\b你想要丢弃哪个物品?"<<endl;
				    else printf("\nWhich Item Do You Want To Throw Away In Your Backpack?\n");
				    int it1;
				    scanf("%d",&it1);
				    it1%=36;
				    blo_arr[it1][0]=0;
				    blo_arr[it1][1]=0;
				}
			}
			else if(a=='B')synthesize(0);
		}
	}
	else if(a=='L'){
		L=1-L;
		return;
	}
	if(!mode && world[x][y][z]!=0 && world[x][y][z]!=14)sta_i_wat_sec%=3,sta_i_wat_sec++;
	else num_of_air+=2,sta_i_wat_sec=0;
	if(num_of_air>10)num_of_air=10;
	if(!mode && sta_i_wat_sec==3)num_of_air--;
	if(be_kil==11 && rand()%20==0)be_kil=12;
	if(be_kil==6 && rand()%15==0)be_kil=14;
	if(be_kil!=6)increase(be_kil,1);
	return;
}

void update_blocks(){
	int tx,ty,tz,tk;
	while(!upd.empty() && upd.top().tck<=tck){
		tx=upd.top().x;
		ty=upd.top().y;
		tz=upd.top().z;
		tk=upd.top().k;
		upd.pop();
        if(tk==0)explosion(tx,ty,tz);
        if(tk==1){
			if(world[tx][ty][tz]==0 || world[tx][ty][tz]==14){
				world[tx][ty][tz]=3;
				upd.push((U){tck+1,tx+1,ty,tz,1});
				upd.push((U){tck+1,tx,ty+1,tz,1});
				upd.push((U){tck+1,tx,ty-1,tz,1});
				upd.push((U){tck+1,tx,ty,tz+1,1});
				upd.push((U){tck+1,tx,ty,tz-1,1});
			}
			if(world[tx][ty][tz]==4)world[tx][ty][tz]=2;
		}
		if(tk==2){
			if(world[tx][ty][tz]==0 || world[tx][ty][tz]==14){
				world[tx][ty][tz]=4;
				upd.push((U){tck+1,tx+1,ty,tz,2});
				upd.push((U){tck+1,tx,ty+1,tz,2});
				upd.push((U){tck+1,tx,ty-1,tz,2});
				upd.push((U){tck+1,tx,ty,tz+1,2});
				upd.push((U){tck+1,tx,ty,tz-1,2});
			}
			if(world[tx][ty][tz]==3)world[tx][ty][tz]=2;
		}
	}
	return;
}

void cre_a_new_arc(){
	char a;
	if(L)cout<<"\b输入存档名:";
	else printf("Enter The Archive Name:");
	cin>>arc_nam;
	arc_nam=arc_nam+".txt";
	if(L)cout<<"\b选择模式:\nA:生存    B:创造\n";
	else printf("Select Mode:\nA:Survival    B:Creative\n");
	scanf(" %c",&a);
	if(a=='A')mode=0;
	else if(a=='B')mode=1;
	if(L)cout<<"\b选择难度:\nA:和平    B:简单    C:普通    D:困难\n";
	else printf("Select Difficulty:\nA:Peaceful    B:Easy    C:Normal    D:Difficult\n");
	scanf(" %c",&a);
	if(a=='A')difficulty=0;
	else if(a=='B')difficulty=1;
	else if(a=='C')difficulty=2;
	else if(a=='D')difficulty=3;
	if(L)cout<<"\b打开自动跳跃?(1 or 0)";
	else printf("Do You Want To Open The Automatic Jump?(1 or 0)");
	scanf("%d",&jum_sel);
	ofstream ouf;
	ouf.open(arc_nam);
	ouf<<mode<<" "<<difficulty<<" "<<jum_sel<<" 0 0";
	ouf.close();
	if(L)cout<<"\b存档 "<<arc_nam<<"  \b创建成功!存档文件请不要随意改动,否则可能造成读档失败!\n";
	else cout<<"The Archive "<<arc_nam<<" Is Created!Please Do Not Change The Archive File At Will, Otherwise It May Cause The File To Fail To Read!"<<endl;
    return;
}

void ent_gen_arc(){
	if(L)cout<<"\b输入存档文件名(不用加\".txt\",请保证存档文件和运行程序在同一地址下):";
	else printf("Enter The Name Of The Archive File (Without \".txt\", Please Make Sure That The Archive File And The Running Program Are In The Aame Address):");
	cin>>arc_nam;
	arc_nam=arc_nam+".txt";
	ifstream inf;
	inf.open(arc_nam);
	inf>>mode>>difficulty>>jum_sel>>exp_lev>>exp_poi;
	inf.close();
	return;
}

int main(){
	srand(time(0));
	char a;
	printf("Minecraft Alpha 2.2\n");
	printf("If You Want To Play In Chinese?(1 or 0)");
	scanf("%d",&l_op);
	if(l_op)L=1;
	if(L)cout<<"存档选项:\nA:新建存档    B:进入已生成存档    C:退出游戏\n";
	else printf("Archive Options:\nA:Create A New Archive    B:Enter The Generated Archive    C:Exit The Game\n");
	scanf(" %c",&a);
	if(a=='A')cre_a_new_arc();
	else if(a=='B')ent_gen_arc();
	else return 0;
	while(true){
		if(L)cout<<"\b经验等级:"<<exp_lev<<endl;
	    else printf("Experience Level:%d\n",exp_lev);
	    if(L)cout<<"\b世界生成选项:\nA:生成新的世界    B:退出游戏\n";
	    else printf("World Generation Options:\nA:Make A New World    B:Exit The Game\n");
	    scanf(" %c",&a);
	    if(a=='A')make_world();
	    else if(a=='B'){
	    	sav_arc();
	    	return 0;
		}
		tck=0;
	    game_state=1;
	    blo_arr[0][0]=13;
	    blo_arr[0][1]=64;
	    life=20;
	    y=256,z=256,x=40;
	    while(x<128 && determine(x+1,y,z))x++;
	    num_of_air=10;
	    TIM_LIF=0;
	    while(true){
		    show_world();
	    	ask_pos();
			for(int i=1;i<=8;i++){
				tck++;
		        update_blocks();
			}
		    if(x>127){
			    if(L)cout<<"\b游戏结束!!!史蒂夫掉出了世界!!!";
				else printf("Game Over!!!\nSteve Fell Out Of The World!!!");
				del_wor(0);
				break;
			}
		    if(!mode && world[x][y][z]==4){
		    	life-=(int)pow(2,difficulty);
		    	TIM_LIF=0;
			    if(L)cout<<"\b游戏结束!!!史蒂夫试图在岩浆里游泳!!!";
				else printf("Game Over!!!\nSteve Tried To Swim In The Lava!!!");
				del_wor(0);
				break;
			}
		    fal_hig=0;
		    while(!mode && x<128 && determine(x+1,y,z)){
		    	x++;
		    	fal_hig++;
		    }
		    if(!mode && fal_hig>6-difficulty && world[x][y][z]!=3){
		    	life-=fal_hig-6+difficulty;
		    	TIM_LIF=0;
		    	if(life<=0){
				    if(L)cout<<"\b游戏结束!!!史蒂夫落地过猛!!!";
					else printf("Game Over!!!\nSteve Landed Too Hard!!!");
					del_wor(0);
					break;
				}
		    }
		    if(!mode && num_of_air<=0){
		    	life--;
		    	TIM_LIF=0;
		    	if(life<=0){
		    		if(L)cout<<"\b游戏结束!!!史蒂夫溺水了!!!";
		    	    else printf("Game Over!!!\nSteve Suffocated To Death!!!");
		    	    del_wor(0);
		    	    break;
		    	}
	    	}
	    	if(!mode && life<=0){
			    if(L)cout<<"\b游戏结束!!!";
			    else printf("Game Over!!!");
			    del_wor(0);
				break;
			}
	    	if(game_state==0)break;
	    	TIM_LIF++;
	    	if(TIM_LIF==10)life++,TIM_LIF=0;
	    	if(life>20)life=20;
        }
	}
	return 0;
}
玩法

在一个存档中,你可以新建世界,在世界中进行探索,探索完毕后,你背包里的所有物品会根据他们的价值转化成经验值(死了不会),这些经验没什么用(敬请期待之后的更新)。
温馨提示:

  • 在退出游戏时,不要直接点右上角的叉叉,应该按U退出世界,然后再退出游戏
  • 存档不会保存世界地图和玩家背包!
操作方式
选项子选项功能
数字0~8选择物品栏
EA显示背包 & 交换背包物品 & 丢弃背包物品
B合成(系统输出合成选项,输入选项和数量)
C退出背包
C选择附近的功能方块
0(工作台)合成(系统输出合成选项,输入选项和数量)
W向北,如果无法向北,则挖掉北面方块
A向西,如果无法向西,则挖掉西面方块
S向南,如果无法向南,则挖掉南面方块
D向东,如果无法向东,则挖掉东面方块
Q往脚下搭方块并向上,如果无法向上,则挖掉头顶方块,并往脚下垫选中方块,然后向上移动一格
Z挖掉下面方块,向下
O显示地图(以玩家为中心96乘96)
UA选择难度
B选择模式
C回到游戏
D退出世界
I显示玩家所在位置所有层数的方块
L转换语言(中英文互转)
  • 如果你试图挖掉TNT,他会在三次操作后爆炸哟!
游戏内容

方块

图标名称英文名硬度程序下标(测试)价值
.泥土soil010.1
,原石stone120.4
~水water-130
_岩浆lava-140
原木wood050.3
*树叶leaves060
"铁矿石iron270.8
'金矿石gold381.2
+基岩bedrock214748364790
%钻石diamond3101.6
!沙子sand0110.1
tTNT方块TNT0130
^树苗sapling0140.2
=木板board0150.1
#工作台crafting_table0221.2
  • 因符号有限,故将部分同类方块合并,如沙子与沙砾,合并成的沙子有5%的概率掉落燧石
  • 原木是 | 符号,此符号无法在 Markdown 格式的表格中打出

物品

名称英文名程序下标(测试)价值
燧石flint120.1
木棍wooden_trick160.06

武器&装备

名称英文名耐久可挖掘硬度程序下标(测试)价值
木镐wooden_pickaxe601171
石镐stone_pickaxe1322181.5
铁镐iron_pickaxe2513193
金镐golden_pickaxe343204
钻石镐diamond_pickaxe15624215.4

视图

本游戏为三维游戏,但是只会显示玩家地板那一层

世界

大小为 512×512×128512 \times 512 \times 128

难度

中文名和平简单普通困难
英文名peacefuleasynormaldifficult
数值0123

游戏刻

游戏刻 tick 为记录游戏时间的变量,玩家的一次操作耗时 8tick8tick 。

方块状态更新

游戏状态更新以 tick 为单位,每 tick 进行一次更新。当一个方块进行状态更新时。

序号含义更新时延/tick
0TNT爆炸24
1水流动1
2岩浆流动1
  • 此次更新修改了树苗的生长机制,使其无法生长,请静等下次更新
回血机制

10次操作( 80tick80tick )回一点

经验值计算方式

设累计获得的经验点为 PP ,经验等级为 LL
则 LL 为满足以下情况的最大整数:

P≥∑i=1L1.2iP \ge {\sum_{i=1}^{L}1.2^i}
爆炸伤害计算方式

设玩家离TNT的距离为 LL ,游戏难度为 DD
则伤害为 ⌊1.9D6−L⌋\lfloor 1.9D^{6-L} \rfloor

摔落伤害计算方式

设摔落高度为 LL ,游戏难度为 DD
则摔落伤害为 L+D−6L+D-6

岩浆伤害计算方式

设游戏难度为 DD
则岩浆伤害为 2D2^D

更新日志

2.0 经验更新&存储更新
2.1 背包更新&修复了一些一已知问题
2.2 tick更新

如有BUG或建议请提出

Made By Moss345512 ( X01wudaiye )