中国像棋/ju.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace 中国像棋
{
class ju:ChessBase
{
public ju(int x, int y, string Imgpath, ChessType type, CheckWin edg)
: base(x, y, Imgpath, type, edg)
{
}
public override bool Eatablemove(Point startpoint,Point endpoint)
{
if (startpoint.X != endpoint.X && startpoint.Y != endpoint.Y)//不在同一条直线上
return false;
if(startpoint.X==endpoint.X)//两个棋子在同一竖线上
{
int minY = startpoint.Y > endpoint.Y ? endpoint.Y : startpoint.Y;
int maxY = startpoint.Y > endpoint.Y ? startpoint.Y : endpoint.Y;
int chessnum = 0;
for(int j =minY+1;j<maxY;j++)
{
foreach (ChessBase chess in ChessBoard.AllChess)
{
if (chess.Y==j && chess.X == startpoint.X)
{
chessnum++;
}
}
}
if (chessnum != 0) return false;
}
if(startpoint.Y == endpoint.Y)
{
int minX = startpoint.X > endpoint.X ? endpoint.X : startpoint.X;
int maxX = startpoint.X > endpoint.X ? startpoint.X : endpoint.X;
int chessnum = 0;
for(int j=minX+1;j<maxX;j++)
{
foreach(ChessBase chess in ChessBoard.AllChess)
{
if (chess.X == j && chess.Y == startpoint.Y)
{
chessnum++;
}
}
}
if (chessnum != 0) return false;
}
return true;
}
后面还有 6 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。