当前位置: 首页 > 图文教程 > Flash动画 > Flash动画制作 > Flash MX 编程深层次应用-网络连线游戏(8)

Flash动画制作
fmx2004 1000问(5)
Flash MX 2004 组件事件简单调试器
fmx2004 1000问(2)
Action Script 2.0新手调试
Flash 2004 MX Components
flash action 详解(9)
flash action 详解(7)
flash action 详解(1)
flash action 详解(6)
一个用纯AS写的正态曲线画法
flash action 详解(3)
浅谈AS的绘图功能及几个简单的实例
AS的基本代码解释(2)
flash action 详解(2)
flash action 详解(10)
运用for循环来对多个mc进行检测
极坐标在绘画方法中的运用
用Flash 2004编写简单的运算类
flash action 详解(4)
flash action 详解(5)

Flash动画制作 中的 Flash MX 编程深层次应用-网络连线游戏(8)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-22   浏览: 81 ::
收藏到网摘: n/a

7.5 实时下棋(2)

    

4.检查哪方胜利的程序

检查哪方胜利的程序如下:

function check_win(row, col, val) {

    var i = col, count = 0;

    // 先检查行连成四子

    while (_root.chess[row][i] == val and i>=0) {

             count++;

             i--;

    }

    if (count>=4) {

             return true;

    }

    i = col+1;

    while (_root.chess[row][i] == val and i<=6) {

             count++;

             i++;

    }

    if (count>=4) {

             return true;

      

    }

    // 再检查列连成四子

    count = 0;

    i = row;

    while (_root.chess[i][col] == val and i<=5) {

             count++;

             i++;

    }

    if (count>=4) {

             return true;

    }

    // 检查左高斜线

    count = 0;

    i = row;

    j = col;

    while (_root.chess[i][j] == val and i>=0 and j>=0) {

       &n