团队-象棋游戏3-模块开发过程

项目托管平台地址:https://gitee.com/zhanghongjian666/ZhongGuoXiangQi/blob/0156ad731ab887b252ada203757058ba78b029e4/zgxq.html
开发模块功能:
棋子加载功能,开发时间:10天(小时),实现棋子的加载,
实现过程是
var QiZi function (qipanrctextisred{
this.text text;
this.isred isred;
this.ctx qipan.ctx;
this.qipan qipan;
this.r;
this.c;
 
 
this.draw();
var that thismaxR that.qipan.maxRmaxC that.qipan.maxC;
this.checkstep (function () {
 
 
if (text == "兵" || text == "卒"{
if (that.4{
 
 
return function (rc{
return this.&& (this.1== && this.== c
|| this.<= && this.== && ((this.1== || (this.1== c)
|| this.<= && (this.1== && this.== c;
}
 
 
else {
return function (rc{
return this.&& (this.1== && this.== || this.>= && this.== && ((this.1== || (this.1== c|| this.>= && (this.1== && this.== c;
}
}
 
 
else if (text == "炮"{
return function (rc{
if (this.!= && this.!= c{
return false;
}
var bodys this.qipan.bodysstep this.getMoveRange(rc);
 
 
return bodys[r][c].qizi != null && step == || bodys[r][c].qizi == null && step == 0;
 
 
}
else if (text == "车" || text == "車"{
return function (rc{
if (this.!= && this.!= c{
return false;
}
return this.getMoveRange(rc== 0;
 
 
}
else if (text == "马" || text == "馬"{
return function (rc{
 
 
return this.== && this.== && this.isEnemyOrEmpty(this.1this.c)
|| this.== && this.== && this.isEnemyOrEmpty(this.1this.c)
|| this.== && this.== && this.isEnemyOrEmpty(this.1this.c)
|| this.== && this.== && this.isEnemyOrEmpty(this.1this.c)
|| this.== && this.== && this.isEnemyOrEmpty(this.rthis.1)
|| this.== && this.== && this.isEnemyOrEmpty(this.rthis.1)
|| this.== && this.== && this.isEnemyOrEmpty(this.rthis.1)
|| this.== && this.== && this.isEnemyOrEmpty(this.rthis.1)
;
}
else if (text == "相" || text == "象"{
return function (rc{
return this.== && this.== && this.isEnemyOrEmpty(this.1this.1)
|| this.== && this.== && this.isEnemyOrEmpty(this.1this.1)
|| this.== && this.== && this.isEnemyOrEmpty(this.1this.1)
|| this.== && this.== && this.isEnemyOrEmpty(this.1this.1)
;
}
else if (text == "士" || text == "仕"{
if (that.4{
return function (rc{
var 7l2 93b2 5;
if (|| l2 || || b2{
return false;
}
return this.== && this.== c
|| this.== && this.== c
|| this.== && this.== c
|| this.== && this.== c
;
}
else {
return function (rc{
var 0l2 33b2 5;
if (|| l2 || || b2{
return false;
}
return this.== && this.== c
|| this.== && this.== c
|| this.== && this.== c
|| this.== && this.== c
;
}
}
 
 
else if (text == "将" || text == "帅"{
if (that.4{
return function (rc{
var 7l2 93b2 5;
if (|| l2 || || b2{
return false;
}
return this.== && this.== c
|| this.== && this.== c
|| this.== && this.== c
|| this.== && this.== c
;
}
else {
return function (rc{
var 0l2 23b2 5;
if (|| l2 || || b2{
return false;
}
return this.== && this.== c
|| this.== && this.== c
|| this.== && this.== c
|| this.== && this.== c
;
}
}
}
return function () {
 
 
};
 
 
}());
}
QiZi.prototype {
isEnemyOrEmptyfunction (rc{
return this.qipan.bodys[r][c].qizi == null;
},

开发炮的功能时遇到了能在错误的规则下吃掉其他子问题,最终使用this.getMoveRange(r, c)方法解决了这个问题 调用方法事方法写错 没进行算法计算。
 
 
 
posted @ 2017-10-26 23:12  咆哮的大熊猫  阅读(302)  评论(0编辑  收藏  举报