免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1177 | 回复: 0
打印 上一主题 下一主题

cadence skill [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-06-24 17:07 |只看该作者 |倒序浏览



       
        文件:skill.tar
        大小:93KB
        下载:
下载
       

               
游戏由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个以上的同色球。

游戏下载请到

以下是计算球成一线的程序原代码:

/******************************/
;;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(i8 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
               
               
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/13793/showart_1010372.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP