首 页 ┆ 源码下载 ┆ IT学院 ┆ 字体下载 ┆ 模板下载 ┆ 源码发布 ┆ 广告合作 ┆ 网站地图
► 设为首页
► 加入收藏
► 联系我们
源码下载 >> ASP源码 | PHP源码 | ASP.net源码 | JSP源码 | CGI源码 | VC/C++源码 | VB源码 | Delphi源码 | Flash源码
文章学院 >> 网络编程 | 网页设计 | 图形图象 | 数据库 | 服务器 | 网络媒体 | 网络安全 | 操作系统 | 办公软件 | 软件开发 | 黑客知识
字体下载 >> 精制字体 | 非英字体 | 艺术字体 | 著名字体 | 哥特式 | 简单字体 | 手写体 | 节假日 | 图案字体 | 精度像素 | 中文字体
模板下载 >> 企业门户 | 数码网络 | 休闲娱乐 | 影视音乐 | 旅游名胜 | 文化艺术 | 电子商务 | 个性展示 | 登陆导航 | Flash模板
►►您当前的位置:源码园 → IT学院 → 网络媒体 → FLASH → 文章内容

Flash MX 编程深层次应用-网络连线游戏(8)

作者:风未起时  来源:中国站长学院  发布时间:2007-2-8 0:34:28
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) {

             count++;

             i--;

             j--;

    }

    if (count>=4) {

             return true;

    }

    i = row+1;

    j = col+1;

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

             count++;

             i++;

             j++;

    }

    if (count>=4) {

             return true;

    }

    // 检查右高斜线

    count = 0;

    i = row;

    j = col;

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

             count++;

             i--;

             j++;

    }

    if (count>=4) {

             return true;

    }

    i = row+1;

    j = col-1;

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

             count++;

             i++;

             j--;

    }

    if (count>=4) {

             return true;

    }

}


[] [返回上一页] [打 印]
  • 上一篇文章:Flash MX 编程深层次应用-网络连线游戏(7)
  • 下一篇文章:FSCommand 用法详解

  • 相关文章:
  • Flash中if条件语句的用法
  • [组图]教你利用Flash制作梦幻仙境效果
  • [组图]用Flash制作简单光晕效果的
  • flash菜单与asp.net进行交互
  • Delphi让你发送Flash电子邮件(2)
  • Delphi让你发送Flash电子邮件(1)
  • Delphi让你发送Flash电子邮件
  • Delphi的两个实用技巧(1)播放Flash
  • 类似于FlashGet的悬浮框的制作
  • 让Word也来播放Flash动画
  • [图文]把Word文件转换成Flash
  • 基于S3C4510B的系统的Flash擦除与烧写问题(一)
关于本站 - 网站帮助 - 广告合作 - 下载声明 - 友情连接 - 网站地图 - 源码发布
Copyright © 2003-2009 Ymyasp.Com. All Rights Reserved .
备案序号:粤ICP备07029071号