自动刮34圈代码

Posted qiu18359243869

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了自动刮34圈代码相关的知识,希望对你有一定的参考价值。

 //自动刮第3,4圈   for  X:=MinX to MaxX do     begin       countmaxy:=0;       countminy:=0;       yminrun:=0;       ymaxrun:=0;       tempmaxX:=MaxX;       TEMPMINX:=MinX;       TEMPMAXY:=MaxY;       TEMPMINY:=MinY;       while  TEMPMAXY-TEMPMINY>=7  do       BEGIN         if (myPD.Map[X,TEMPMINY] IS TChipData) then           begin             countminy:=countminy+1;             if ((countminY=3) OR (countminY=4)) and (mypd.Map[X,TEMPMINY].GetValueByItem(‘Bin‘)=166)  and (yminRun<2) then             BEGIN               yminRun:=yminRun+1;               RX := X - 128;               RY := (TEMPMINY - 128) * -1;               XStringList.Add(IntToStr(RX));               YStringList.Add(IntToStr(RY));               SNStringList.Add(myPD.Map[X,TEMPMINY].SNumber + ‘^‘ + myPD.Map[X,TEMPMINY].CorolBool);             END;             TEMPMINY:=TEMPMINY+1;           end         else if (yminRun<2) then           begin             TEMPMINY:=TEMPMINY+1;           end           else           begin             TEMPMINY:=TEMPMINY;           end;

          if (myPD.Map[X,TEMPMAXY] IS TChipData)  then           begin             countmaxY:=countmaxy+1;             if (countmaxY=3) and  (ymaxRun<2) and (mypd.Map[X,TEMPMAXY].GetValueByItem(‘Bin‘)=166) then               BEGIN                 ymaxRun:=ymaxRun+1;                 RX := X - 128;                 RY := (TEMPMAXY - 128) * -1;                 XStringList.Add(IntToStr(RX));                 YStringList.Add(IntToStr(RY));                 SNStringList.Add(myPD.Map[X,TEMPMAXY].SNumber + ‘^‘ + myPD.Map[X,TEMPMAXY].CorolBool);               end;               if (countmaxY=4) and  (ymaxRun<2) and (mypd.Map[X,TEMPMAXY].GetValueByItem(‘Bin‘)=166) then               BEGIN                 ymaxRun:=ymaxRun+1;                 RX := X - 128;                 RY := (TEMPMAXY - 128) * -1;                 XStringList.Add(IntToStr(RX));                 YStringList.Add(IntToStr(RY));                 SNStringList.Add(myPD.Map[X,TEMPMAXY].SNumber + ‘^‘ + myPD.Map[X,TEMPMAXY].CorolBool);               end;               TEMPMAXY:=TEMPMAXY-1;           end           else if (ymaxRun<2)  then           begin             TEMPMAXY:=TEMPMAXY-1;           end           else           begin             TEMPMAXY:=TEMPMAXY;           end;

          if (yminRun>=2) AND (ymaxRun>=2) then           begin             Break;           end;          lastX:=X;       end;     end;

 

  //自动刮第3,4圈   for  Y:=Miny to Maxy do     begin       countmaxx:=0;       countminx:=0;       xminrun:=0;

      xmaxrun:=0;       TEMPMAXY:=MaxY;       TEMPMINY:=MinY;       tempmaxX:=MaxX;       TEMPMINX:=MinX;

      while  TEMPMAXx-TEMPMINx>=7  do       BEGIN         if (myPD.Map[TEMPMINX,Y] IS TChipData)  then           begin             countminX:=countminX+1;             if ((countminX=3) OR (countminX=4)) and (XminRun<2)   and (mypd.Map[TEMPMINX,Y].GetValueByItem(‘Bin‘)=166) then             BEGIN               XminRun:=XminRun+1;               RX := TEMPMINX - 128;               RY := (Y - 128) * -1;               XStringList.Add(IntToStr(RX));               YStringList.Add(IntToStr(RY));               SNStringList.Add(myPD.Map[TEMPMINX,Y].SNumber + ‘^‘ + myPD.Map[TEMPMINX,Y].CorolBool);             END;             TEMPMINX:=TEMPMINX+1;           end         else if (XminRun<2) then           begin             TEMPMINX:=TEMPMINX+1;           end           else           begin             TEMPMINX:=TEMPMINX;           end;

          if (myPD.Map[tempmaxX,Y] IS TChipData)  then           begin             countmaxX:=countmaxX+1;             if (countmaxX=3) and  (XmaxRun<2) and (mypd.Map[tempmaxX,Y].GetValueByItem(‘Bin‘)=166) then               BEGIN                 XmaxRun:=XmaxRun+1;                 RX := tempmaxX - 128;                 RY := (Y - 128) * -1;                 XStringList.Add(IntToStr(RX));                 YStringList.Add(IntToStr(RY));                 SNStringList.Add(myPD.Map[tempmaxX,Y].SNumber + ‘^‘ + myPD.Map[tempmaxX,Y].CorolBool);               end;               if (countmaxX=4) and  (XmaxRun<2) and (mypd.Map[tempmaxX,Y].GetValueByItem(‘Bin‘)=166) then               BEGIN                 XmaxRun:=XmaxRun+1;                 RX := tempmaxX - 128;                 RY := (Y - 128) * -1;                 XStringList.Add(IntToStr(RX));                 YStringList.Add(IntToStr(RY));                 SNStringList.Add(myPD.Map[tempmaxX,Y].SNumber + ‘^‘ + myPD.Map[tempmaxX,Y].CorolBool);               end;               tempmaxX:=tempmaxX-1;           end           else if (XmaxRun<2)  then           begin             tempmaxX:=tempmaxX-1;           end           else           begin             tempmaxX:=tempmaxX;           end;

          if (XminRun>=2) AND (XmaxRun>=2) then           begin             Break;           end;          lastY:=Y;       end;     end;

  //end 自动刮第3,4圈

 

以上是关于自动刮34圈代码的主要内容,如果未能解决你的问题,请参考以下文章

HTML+CSS+JS实现canvas仿ps橡皮擦刮卡效果

HTML+CSS+JS实现canvas仿ps橡皮擦刮卡效果

移动端Touch事件与H5-Canvas像素点检测实现刮刮乐

30行代码实现朋友圈自动点赞

如何刮内容?

圈复杂度 Cyclomatic complexity 介绍