Esempio n. 1
0
void Terrain::init(Road* road) {
	int i,j;

	mRoad = road;

	mRoadTexture = new BmpTexture(10);
	mBridgeTexture = new BmpTexture(11);

	mRoadTexture->load("resources/road.bmp");
	mBridgeTexture->load("resources/bridge.bmp");


	for(i=0;i<GRID_SIZE;i++) {
		for(j=0;j<GRID_SIZE;j++)
		{
			mGrid[i][j] = 0.1;
		}
	}

	for(i=93;i<103;i++) {
		for(j=47;j<57;j++)
		{
			mGrid[i][j] = -0.1;
		}
	}
	for(i=1;i<200;i++) {
		generate3();
	}
	for(i=1;i<400;i++) {
		generate1();
	}
	for(i=1;i<50;i++) {
		generate2();
	}
	smooth();
	for(i=1;i<5;i++) {
		generate2();
	}
}
Esempio n. 2
0
int main()
{
	int i,j,k,gn=1;
//	int g[graph_scale][graph_scale];
	char filename2[5]={'.','t','x','t','\0'};
	char filename3[15]="frequency.txt";
	initial1();               //初始记录频繁度的矩阵
//	char filename1[10];
	while(gn<=graph_num)
	{
		i=48+int(gn/100);
		j=48+(gn-int(gn/100)*100)/10;
		k=48+gn-int(gn/100)*100-(j-48)*10;
		char filename1[15]={i,j,k,'\0'};
        strcat(filename1,filename2);    //记事本文件名
		initial3();
		initial2();       //将图的关联矩阵初始化为0
		generate1();     //生成图的关联矩阵行标和列标
        generate2();     //将边注入关联矩阵中
		txt_out1(filename1);   //将图放到记事本中
		if(g[0][31]>side)
		{
			side=g[0][31];
			strcpy(sname,filename1);
		}
		if(g[31][0]>dot)
		{
			dot=g[31][0];
			strcpy(dname,filename1);
		}
		gn++;
	}
	txt_out2(filename3);
	printf("Max sidesign is %c in %s.\n",side,sname);
	printf("Max potsign is %c in %s.\n",dot,dname);

}