cadence skill
(2008-06-24 17:07)
·ÖÀࣺ ¹«Ë¾±¾

|
ÓÎÏ·ÓÉ9X9=81¸ö¸ñ×Ó×é³É£¬³ÌÐòÖÐÒÔÊý×é nValue À´¶¨Òå¡£¶¨ÒåÁËһЩ²»Í¬×ÅÉ«µÄÇò£¬²¢Ëæ»ú²úÉú£¬²¢Ëæ»ú°Ú·Åµ½81¸ö¸ñ×ÓÉÏ¡£³ÌÐòÖ÷ÒªÓÐÒÔϼ¸¸ö²¿·Ö×é³É£º
colorlineMainForm()£»ÓÃhiCreatebutton²úÉú81¸öbutton£¬´´Ô첻ͬɫ²ÊµÄÇò¡£
fBallRandom();; Ëæ»ú²úÉúÇò²¢°Ú·Å£¬²¢É趨ֵ8Ϊ±³¾°£¬Ð¡ÓÚ8µÄÖµ¾ùÀí½âΪÓÐÇò¡£»¹¶¨ÒåÁËÁ½¸ölist£¬lBallnoexistºÍlBallexistÀ´´æ´¢µ±È»ÓÐÇòµÄÇøÓòºÍûÇòµÄÇøÓò¡£
fListReduce(),fListReducebymatch(),fListReducebynmatch()ÕâÈý¸öº¯Êý¶¼ÊÇÓÃÀ´¼õÉÙlistÖеÄÖµµÄ£¬ÒÔÆ½ºâlBallnoexistÓëlBallexistµÄ¹ØÏµ¡£
fBallRefresh()£»ÊÇÓÃÀ´¸Ä±äÇòµÄͼ±ê¡£
fBallSelect()£»ÔòÊǶ¨ÒåµãÈ¡µÄÇòÊÇÆðµãÇò»¹ÊÇÖÕµãλÖá£
fBallDir()£»ÊÇÔËËãÇòµÄÐÐ×ß·½Ïò£¬×óÓÒÉÏϵÄ˳Ðò¡£
fBallMove()£»ÒÔfBallDir()·´À¡µÄÖµÀ´Òƶ¯Çò¡£
fNewGame()£»³õʼ»¯Öµ£¬¿ªÊ¼ÐµÄÓÎÏ·¡£
fBallDispear()£»ÏûÈ¥ÒªÏûʧµÄÇò¡£
fBallInLine() £»¼ÆËãÇò³ÉÒ»ÌõÏߣ¬²¢ÇÒÓÐ5¸öÒÔÉϵÄͬɫÇò¡£
ÓÎÏ·ÏÂÔØÇëµ½
ÒÔÏÂÊǼÆËãÇò³ÉÒ»ÏߵijÌÐòÔ´úÂ룺
/******************************/
;;define ball in line and disappear func
;;define ball array 0_redball 1_yellowball 2_blueball
;;3_greenball 4_brownball 5_cyanball 6_purple 7_azure 8_noball 9_background 10_selected_bgISblack
;;there are 6 and bigger 6 ball in a line then remove the ball line
;;and give the value to 6
/******************************/
procedure(fBallInLine(nballx nbally)
prog(()
nReturn=t;
nCenterNumber=nbally*9+nballx;
nRefValue=nValue[nCenterNumber];
lInFive=list(nCenterNumber);
nInFive=0;
for(i 0 8
nLineNumber=nbally*9+i;
nLineValue=nValue[nLineNumber];
if(nLineValue == nRefValue then
nInFive++
lInFive=fListReducebynmatch(lInFive nLineNumber);
lInFive=append1(lInFive nLineNumber);
else
fBallDispear(nInFive lInFive);
nInFive=0;
lInFive=list(nCenterNumber);
));if_for
fBallDispear(nInFive lInFive);
nInFive=0;
for(j 0 8
nLineNumber=j*9+nballx
nLineValue=nValue[nLineNumber];
if(nLineValue == nRefValue then
nInFive++
lInFive=fListReducebynmatch(lInFive nLineNumber);
lInFive=append1(lInFive nLineNumber);
else
fBallDispear(nInFive lInFive);
nInFive=0;
lInFive=list(nCenterNumber);
));if
fBallDispear(nInFive lInFive);
nInFive=0;
i=nballx-nbally
j=0
if(i<0 then
i=0
j=nbally-nballx
);if
while((max i j)<9
nLineNumber=j*9+i;
nLineValue=nValue[nLineNumber];
if(nLineValue == nRefValue then
nInFive++
lInFive=fListReducebynmatch(lInFive nLineNumber);
lInFive=append1(lInFive nLineNumber);
else
fBallDispear(nInFive lInFive);
nInFive=0;
lInFive=list(nCenterNumber);
);if
i++
j++
);while_i_j
fBallDispear(nInFive lInFive);
nInFive=0;
i=nballx+nbally
j=0
if(i>8 then
i=8
j=nballx+nbally-8
);if
while((and i>=0 j<9)
nLineNumber=j*9+i;
;printf("%d %d %d
" nballx nbally nLineNumber);
nLineValue=nValue[nLineNumber];
if(nLineValue == nRefValue then
nInFive++
lInFive=fListReducebynmatch(lInFive nLineNumber);
lInFive=append1(lInFive nLineNumber);
else
fBallDispear(nInFive lInFive);
nInFive=0;
lInFive=list(nCenterNumber);
);if
i--
j++
);while_i_j
fBallDispear(nInFive lInFive);
return(nReturn);
));fBallInLine


