Tetris1

来源:互联网 发布:阿里移动推荐算法大赛 编辑:程序博客网 时间:2024/06/11 05:36


int get_row_trans(){
 int current,next,row_trans=0;
 for (int y=20;y>=1;y--){
  current = 1;
  for (int x=0;x<=9;x++)
  {  
   next = pool_image[x][y];
   if ((current ==0  && next != 0) || (current !=0  && next == 0))
   {
    row_trans++;
   }
   current = pool_image[x][y];
  }

  if (current==0)
   row_trans++;
 }
 return row_trans;
}

int get_col_trans(){
 int current,next,col_trans=0;
 for (int x=0;x<=9;x++){
  current = 1;
  for (int y=20;y>=1;y--)
  {
   next = pool_image[x][y];
   if ((current == 0  && next != 0) || (current !=0  && next == 0))
   {
    col_trans++;
   }
   current = pool_image[x][y];
  }
 }
 return col_trans;
}

原创粉丝点击