其他分享
首页 > 其他分享> > 2021-07-11

2021-07-11

作者:互联网

if (newFunFlag) {   
		if (currentShapeNum == 0)当前图形为I型
		{
			int wells_a = 0,计算上面无方块的井深
				holes_wells = 0,井上有无方块
				wells_count = 0,井数量
				wells_ab1 = 0,记录井深
				row_1 = 0,行
				col_1 = 0,列
				holes_wells_a = 0;
			for (int j = 0; j < STAGE_WIDTH; j++)
			{
				for (int i = STAGE_HEIGHT-1; i >=0; i--)
				{
					if (Field[i][j] == 0)
					{
						if ((j - 1 < 0 || Field[i][j - 1] > 0) && (j + 1 >= STAGE_WIDTH || Field[i][j + 1] > 0))
						{//两边是墙或者实心方格
							wells_a++;
						}
						if (Field[i - 1][j])井上有方块
							holes_wells++;
					}
					if (((holes_wells == 0) && ((wells_a == 3) || (wells_a == 4)))&& ((j - 1 < 0 || Field[i][j - 1] > 0) && (j + 1 >= STAGE_WIDTH || Field[i][j + 1] > 0)))test
					{
						wells_ab1 = wells_a;
						holes_wells_a = holes_wells;
						row_1 = i;
						col_1 = j;
					}
                    if (((holes_wells_a == 0) &&((wells_ab1==3)|| (wells_ab1 == 4)))&&((j - 1 < 0 || Field[i][j - 1] > 0) && (j + 1 >= STAGE_WIDTH || Field[i][j + 1] > 0)))有上面无方块的井-》下落插入井
                    {
                    	    wells_count++;
                    }
				}
				wells_a = 0;
				holes_wells = 0;
			}
				if (wells_count)有井,插入√
				{
					
					for (int t = 0; t < 4; t++)
						currentSquare[t].x = currentSquare[t].x -STAGE_WIDTH/2+ col_1-1;如果有几个3或4深度井,直接移到最右的井上
					
				}
				else无井->放到hold区
				{
					if (hold_count == 0)hold区无方块
					{
						holdFunc();
						hold_count = 1;
						goto aa;

					}
					else√
					{
						if(holdShapeNum!=0)
							
						    holdFunc();
					}

				}
		}
		
		else当前方块为其他方块
		{
		aa:
			int wells_a = 0,计算上面无方块的井深
				wells_count = 0,
				holes_wells = 0,
				temp = 0,
				wells_ab2 = 0,
				row_2,行
				col_2,列
			    holes_wells_b=0;
			for (int j = 0; j < STAGE_WIDTH; j++)
			{
				for (int i = STAGE_HEIGHT - 1; i >=0; i--)
				{
					if (Field[i][j] == 0)
					{
						if ((j - 1 < 0 || Field[i][j - 1] > 0) && (j + 1 >= STAGE_WIDTH || Field[i][j + 1] > 0))
						{//两边是墙或者实心方格
							wells_a++;
						}
						if (Field[i - 1][j])井上有方块
							holes_wells++;
					}
					if ((((wells_a == 3) || (wells_a == 4))&&(holes_wells==0))&& ((j - 1 < 0 || Field[i][j - 1] > 0) && (j + 1 >= STAGE_WIDTH || Field[i][j + 1] > 0)))///test 
					{
						wells_ab2 = wells_a;
						holes_wells_b = holes_wells;
						row_2 = i;
						col_2 = j;
					}
                    if (((holes_wells_b == 0) && ((wells_ab2 == 3) || (wells_ab2 == 4)))&& ((j - 1 < 0 || Field[i][j - 1] > 0) && (j + 1 >= STAGE_WIDTH || Field[i][j + 1] > 0)))有上面无方块的井-》下落插入井
                    {
                    	wells_count++;
                    	
                    }
				}
				
				wells_a = 0;
				holes_wells = 0;
			}


				if (wells_count)√
				{
					if (hold_count)hold有图形
						if (holdShapeNum == 0)I型图形
							holdFunc();将I型换出来插入井
				}
											
		}
		if (newFunFlag) 
		{
			   PierreDellacherie();
			   for (int j = 0; j < tPD.r; j++) {   
			   	AIRotateFunc();
			   }
			   for (int i = 0; i < 4; i++) {      
			   	currentSquare[i].x += tPD.x;
			   }
			   newFunFlag = false;
		}
	}

标签:11,07,++,holes,wells,Field,2021,&&,STAGE
来源: https://blog.csdn.net/qq_41994314/article/details/118650819