好长时间没有碰java了,在网络上找到一个纯java写的单机版中国象棋,感兴趣的研究了一下,结果发现了几个错误:1。没有胜负结果的判定,老将死掉后还可以继续下棋;2。老将的活动范围没有仅限在田字格内。3。老将对脸问题没有解决。经过对源程序的一番手术,修正了以上的错误,现发布出来感兴趣的可以看一看,蛮有意思的。
![](https://p-blog.csdn.net/images/p_blog_csdn_net/wodedipan2008/xiangqi1.bmp)
主类
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//*
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Chess.java
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
import javax.swing.*;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
import java.awt.*;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
import java.awt.event.*;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
import java.io.*;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
import java.util.LinkedList;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
public class Chess extends JFrame implements ActionListener
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ChessBoard board=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Demon demon=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
MakeChessManual record=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Container con=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
JMenuBar bar;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
JMenu fileMenu;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
JMenuItem 双人对弈,保存棋谱,演示棋谱;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
JFileChooser fileChooser=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
LinkedList 棋谱=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public Chess()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
bar=new JMenuBar();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
fileMenu=new JMenu("中国象棋");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
双人对弈=new JMenuItem("双人对弈");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
保存棋谱=new JMenuItem("保存棋谱");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
演示棋谱=new JMenuItem("演示棋谱");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
fileMenu.add(双人对弈);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
fileMenu.add(保存棋谱);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
fileMenu.add(演示棋谱);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
bar.add(fileMenu);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
setJMenuBar(bar);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
setTitle(双人对弈.getText());
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
双人对弈.addActionListener(this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
保存棋谱.addActionListener(this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
演示棋谱.addActionListener(this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
board=new ChessBoard(45,45,9,10);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
record=board.record;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
con=getContentPane();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
JSplitPane split=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,board,record);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
split.setDividerSize(5);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
split.setDividerLocation(460);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
con.add(split,BorderLayout.CENTER);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
addWindowListener(new WindowAdapter()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{ public void windowClosing(WindowEvent e)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{ System.exit(0);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
});
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
setVisible(true);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
setBounds(60,20,670,540);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
fileChooser=new JFileChooser();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
con.validate();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
validate();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public void actionPerformed(ActionEvent e)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(e.getSource()==双人对弈)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
con.removeAll();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
保存棋谱.setEnabled(true);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.setTitle(双人对弈.getText());
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
board=new ChessBoard(45,45,9,10);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
record=board.record;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
JSplitPane split=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,board,record);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
split.setDividerSize(5);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
split.setDividerLocation(460);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
con.add(split,BorderLayout.CENTER);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
validate();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(e.getSource()==保存棋谱)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int state=fileChooser.showSaveDialog(null);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
File saveFile =fileChooser.getSelectedFile();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(saveFile!=null&&state==JFileChooser.APPROVE_OPTION)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{try
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
FileOutputStream outOne=new FileOutputStream(saveFile);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ObjectOutputStream outTwo=new ObjectOutputStream(outOne);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
outTwo.writeObject(record.获取棋谱()) ;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
outOne.close();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
outTwo.close();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
catch(IOException event)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(e.getSource()==演示棋谱)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
con.removeAll();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
con.repaint();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
con.validate();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
validate();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
保存棋谱.setEnabled(false);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int state=fileChooser.showOpenDialog(null);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
File openFile =fileChooser.getSelectedFile();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(openFile!=null&&state==JFileChooser.APPROVE_OPTION)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{try
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
FileInputStream inOne=new FileInputStream(openFile);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ObjectInputStream inTwo=new ObjectInputStream(inOne);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
棋谱=(LinkedList)inTwo.readObject() ;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
inOne.close();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
inTwo.close();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ChessBoard board=new ChessBoard(45,45,9,10);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
demon=new Demon(board);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
demon.set棋谱(棋谱);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
con.add(demon,BorderLayout.CENTER);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
con.validate();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
validate();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.setTitle(演示棋谱.getText()+":"+openFile);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
catch(Exception event)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
JLabel label=new JLabel("不是棋谱文件");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
label.setFont(new Font("隶书",Font.BOLD,60));
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
label.setForeground(Color.red);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
label.setHorizontalAlignment(SwingConstants.CENTER);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
con.add(label,BorderLayout.CENTER);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
con.validate();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.setTitle("没有打开棋谱");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
validate();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
JLabel label=new JLabel("没有打开棋谱文件呢");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
label.setFont(new Font("隶书",Font.BOLD,50));
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
label.setForeground(Color.pink);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
label.setHorizontalAlignment(SwingConstants.CENTER);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
con.add(label,BorderLayout.CENTER);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
con.validate();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.setTitle("没有打开棋谱文件呢");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
validate();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public static void main(String args[])
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
new Chess();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
棋盘类
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//*
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ChessBoard.java
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
import javax.swing.*;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
import java.awt.*;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
import java.awt.event.*;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
public class ChessBoard extends JPanel implements MouseListener,MouseMotionListener
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
JPanel Message;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public ChessPoint point[][];
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public int unitWidth,unitHeight;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int x轴长,y轴长;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int x,y;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
boolean move=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public String 红方颜色="红色",黑方颜色="黑色";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ChessPiece 红车1,红车2,红马1,红马2,红相1,红相2,红帅,红士1,红士2,
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红兵1,红兵2,红兵3,红兵4,红兵5,红炮1,红炮2;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ChessPiece 黑车1,黑车2,黑马1,黑马2,黑将,黑士1,黑士2,
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑卒1,黑卒2,黑卒3,黑卒4,黑卒5,黑象1,黑象2,黑炮1,黑炮2;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int startX,startY;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int startI,startJ;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public boolean 红方走棋=true,黑方走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Rule rule=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public MakeChessManual record=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public ChessBoard(int w,int h,int r,int c)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
setLayout(null);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
addMouseListener(this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
addMouseMotionListener(this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Color bc=getBackground();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
unitWidth=w;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
unitHeight=h;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
x轴长=r;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
y轴长=c;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point=new ChessPoint[r+1][c+1];
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(int i=1;i<=r;i++)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(int j=1;j<=c;j++)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[i][j]=new ChessPoint(i*unitWidth,j*unitHeight,false);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
rule=new Rule(this,point);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
record=new MakeChessManual(this,point) ;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红车1=new ChessPiece("车",Color.red,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红车1.set棋子类别(红方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红车2=new ChessPiece("车",Color.red,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红车2.set棋子类别(红方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红马1=new ChessPiece("马",Color.red,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红马1.set棋子类别(红方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红马2=new ChessPiece("马",Color.red,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红马2.set棋子类别(红方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红炮1=new ChessPiece("炮",Color.red,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红炮1.set棋子类别(红方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红炮2=new ChessPiece("炮",Color.red,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红炮2.set棋子类别(红方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红相1=new ChessPiece("相",Color.red,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红相1.set棋子类别(红方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红相2=new ChessPiece("相",Color.red,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红相2.set棋子类别(红方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红士1=new ChessPiece("士",Color.red,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红士1.set棋子类别(红方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红士2=new ChessPiece("士",Color.red,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红士2.set棋子类别(红方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红帅=new ChessPiece("帅",Color.red,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红帅.set棋子类别(红方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红兵1=new ChessPiece("兵",Color.red,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红兵1.set棋子类别(红方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红兵2=new ChessPiece("兵",Color.red,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红兵2.set棋子类别(红方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红兵3=new ChessPiece("兵",Color.red,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红兵3.set棋子类别(红方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红兵4=new ChessPiece("兵",Color.red,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红兵4.set棋子类别(红方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红兵5=new ChessPiece("兵",Color.red,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红兵5.set棋子类别(红方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑将=new ChessPiece("将",Color.blue,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑将.set棋子类别(黑方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑士1=new ChessPiece("士",Color.blue,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑士1.set棋子类别(黑方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑士2=new ChessPiece("士",Color.blue,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑士2.set棋子类别(黑方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑车1=new ChessPiece("车",Color.blue,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑车1.set棋子类别(黑方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑车2=new ChessPiece("车",Color.blue,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑车2.set棋子类别(黑方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑炮1=new ChessPiece("炮",Color.blue,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑炮1.set棋子类别(黑方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑炮2=new ChessPiece("炮",Color.blue,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑炮2.set棋子类别(黑方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑象1=new ChessPiece("象",Color.blue,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑象1.set棋子类别(黑方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑象2=new ChessPiece("象",Color.blue,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑象2.set棋子类别(黑方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑马1=new ChessPiece("马",Color.blue,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑马1.set棋子类别(黑方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑马2=new ChessPiece("马",Color.blue,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑马2.set棋子类别(黑方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑卒1=new ChessPiece("卒",Color.blue,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑卒1.set棋子类别(黑方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑卒2=new ChessPiece("卒",Color.blue,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑卒2.set棋子类别(黑方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑卒3=new ChessPiece("卒",Color.blue,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑卒3.set棋子类别(黑方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑卒4=new ChessPiece("卒",Color.blue,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑卒4.set棋子类别(黑方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑卒5=new ChessPiece("卒",Color.blue,bc,w-4,h-4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑卒5.set棋子类别(黑方颜色);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[1][10].setPiece(红车1,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[2][10].setPiece(红马1,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[3][10].setPiece(红相1,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[4][10].setPiece(红士1,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[5][10].setPiece(红帅,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[6][10].setPiece(红士2,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[7][10].setPiece(红相2,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[8][10].setPiece(红马2,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[9][10].setPiece(红车2,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[2][8].setPiece(红炮1,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[8][8].setPiece(红炮2,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[1][7].setPiece(红兵1,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[3][7].setPiece(红兵2,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[5][7].setPiece(红兵3,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[7][7].setPiece(红兵4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[9][7].setPiece(红兵5,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[1][1].setPiece(黑车1,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[2][1].setPiece(黑马1,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[3][1].setPiece(黑象1,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[4][1].setPiece(黑士1,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[5][1].setPiece(黑将,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[6][1].setPiece(黑士2,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[7][1].setPiece(黑象2,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[8][1].setPiece(黑马2,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[9][1].setPiece(黑车2,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[2][3].setPiece(黑炮1,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[8][3].setPiece(黑炮2,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[1][4].setPiece(黑卒1,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[3][4].setPiece(黑卒2,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[5][4].setPiece(黑卒3,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[7][4].setPiece(黑卒4,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[9][4].setPiece(黑卒5,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public void paintComponent(Graphics g)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
super.paintComponent(g);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(int j=1;j<=y轴长;j++)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
g.drawLine(point[1][j].x,point[1][j].y,point[x轴长][j].x,point[x轴长][j].y);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(int i=1;i<=x轴长;i++)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(i!=1&&i!=x轴长)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
g.drawLine(point[i][1].x,point[i][1].y,point[i][y轴长-5].x,point[i][y轴长-5].y);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
g.drawLine(point[i][y轴长-4].x,point[i][y轴长-4].y,point[i][y轴长].x,point[i][y轴长].y);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
g.drawLine(point[i][1].x,point[i][1].y,point[i][y轴长].x,point[i][y轴长].y);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
g.drawLine(point[4][1].x,point[4][1].y,point[6][3].x,point[6][3].y);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
g.drawLine(point[6][1].x,point[6][1].y,point[4][3].x,point[4][3].y);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
g.drawLine(point[4][8].x,point[4][8].y,point[6][y轴长].x,point[6][y轴长].y);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
g.drawLine(point[4][y轴长].x,point[4][y轴长].y,point[6][8].x,point[6][8].y);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(int i=1;i<=x轴长;i++)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
g.drawString(""+i,i*unitWidth,unitHeight/2);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int j=1;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(char c='A';c<='J';c++)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
g.drawString(""+c,unitWidth/4,j*unitHeight);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
j++;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public void mousePressed(MouseEvent e)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ChessPiece piece=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Rectangle rect=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(e.getSource()==this)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
move=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(move==false)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(e.getSource() instanceof ChessPiece)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
piece=(ChessPiece)e.getSource();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
startX=piece.getBounds().x;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
startY=piece.getBounds().y;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
rect=piece.getBounds();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(int i=1;i<=x轴长;i++)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(int j=1;j<=y轴长;j++)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int x=point[i][j].getX();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int y=point[i][j].getY();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(rect.contains(x,y))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
startI=i;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
startJ=j;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
break;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public void mouseMoved(MouseEvent e)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public void mouseDragged(MouseEvent e)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ChessPiece piece=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(e.getSource() instanceof ChessPiece)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
piece=(ChessPiece)e.getSource();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
move=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
e=SwingUtilities.convertMouseEvent(piece,e,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(e.getSource()==this)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(move&&piece!=null)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
x=e.getX();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
y=e.getY();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(红方走棋&&((piece.棋子类别()).equals(红方颜色)))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
piece.setLocation(x-piece.getWidth()/2,y-piece.getHeight()/2);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(黑方走棋&&(piece.棋子类别().equals(黑方颜色)))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
piece.setLocation(x-piece.getWidth()/2,y-piece.getHeight()/2);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public void mouseReleased(MouseEvent e)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ChessPiece piece=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
move=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Rectangle rect=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(e.getSource() instanceof ChessPiece)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
piece=(ChessPiece)e.getSource();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
rect=piece.getBounds();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
e=SwingUtilities.convertMouseEvent(piece,e,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(e.getSource()==this)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
boolean containChessPoint=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int x=0,y=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int m=0,n=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(piece!=null)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(int i=1;i<=x轴长;i++)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(int j=1;j<=y轴长;j++)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
x=point[i][j].getX();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
y=point[i][j].getY();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(rect.contains(x,y))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
containChessPoint=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m=i;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
n=j;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
break;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(piece!=null&&containChessPoint)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Color pieceColor=piece.获取棋子颜色();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[m][n].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Color c=(point[m][n].getPiece()).获取棋子颜色();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(pieceColor.getRGB()==c.getRGB())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
piece.setLocation(startX,startY);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
(point[startI][startJ]).set有棋子(true);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
boolean ok=rule.movePieceRule(piece,startI,startJ, m,n);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(ok)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ChessPiece pieceRemoved=point[m][n].getPiece();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[m][n].reMovePiece(pieceRemoved,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[m][n].setPiece(piece,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
(point[startI][startJ]).set有棋子(false);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
record.记录棋谱(piece,startI,startJ,m,n) ;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
record.记录吃掉的棋子(pieceRemoved) ;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(pieceRemoved.getName().equals("将"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红方走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑方走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
JOptionPane.showMessageDialog(Message,"恭喜红方棋手获得本局对弈胜利");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(pieceRemoved.getName().equals("帅"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红方走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑方走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
JOptionPane.showMessageDialog(Message,"恭喜蓝方棋手获得本局对弈胜利");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(piece.棋子类别().equals(红方颜色))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红方走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑方走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(piece.棋子类别().equals(黑方颜色))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑方走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红方走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
validate();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
repaint();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
piece.setLocation(startX,startY);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
(point[startI][startJ]).set有棋子(true);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
boolean ok=rule.movePieceRule(piece,startI,startJ, m,n);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(ok)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
point[m][n].setPiece(piece,this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
(point[startI][startJ]).set有棋子(false);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
record.记录棋谱(piece,startI,startJ,m,n) ;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
record.记录吃掉的棋子("没吃棋子");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(piece.棋子类别().equals(红方颜色))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红方走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑方走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(piece.棋子类别().equals(黑方颜色))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
黑方走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
红方走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
piece.setLocation(startX,startY);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
(point[startI][startJ]).set有棋子(true);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(piece!=null&&!containChessPoint)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
piece.setLocation(startX,startY);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
(point[startI][startJ]).set有棋子(true);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public void mouseEntered(MouseEvent e)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public void mouseExited(MouseEvent e)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public void mouseClicked(MouseEvent e)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
棋子类
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//*
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ChessPiece.java
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
import javax.swing.*;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
import java.awt.*;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
import java.awt.event.*;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
public class ChessPiece extends JLabel
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
String name;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Color backColor=null,foreColor;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
String 颜色类别=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ChessBoard board=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int width,height;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public ChessPiece(String name,Color fc,Color bc,int width,int height,ChessBoard board)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.name=name;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.board=board;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.width=width;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.height=height;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
foreColor=fc;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
backColor=bc;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
setSize(width,height);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
setBackground(bc);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
addMouseMotionListener(board);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
addMouseListener(board);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public void paint(Graphics g)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
g.setColor(foreColor);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
g.fillOval(2,2,width-2,height-2);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
g.setColor(Color.white);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
g.setFont(new Font("隶书",Font.BOLD,28));
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
g.drawString(name,7,height-8);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
g.setColor(Color.yellow);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
g.drawOval(2,2,width-2,height-2);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public int getWidth()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return width;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public int getHeight()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return height;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public String getName()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return name;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public Color 获取棋子颜色()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return foreColor;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public void set棋子类别(String 类别)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
颜色类别=类别;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public String 棋子类别()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return 颜色类别;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
棋子落点类
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//*
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ChessPoint.java
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
public class ChessPoint
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int x,y;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
boolean 有棋子;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ChessPiece piece=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ChessBoard board=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public ChessPoint(int x,int y,boolean boo)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.x=x;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.y=y;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
有棋子=boo;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public boolean isPiece()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return 有棋子;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public void set有棋子(boolean boo)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
有棋子=boo;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public int getX()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return x;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public int getY()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return y;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public void setPiece(ChessPiece piece,ChessBoard board)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.board=board;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.piece=piece;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
board.add(piece);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int w=(board.unitWidth);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int h=(board.unitHeight);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
piece.setBounds(x-w/2,y-h/2,w,h);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
有棋子=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
board.validate();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public ChessPiece getPiece()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return piece;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public void reMovePiece(ChessPiece piece,ChessBoard board)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.board=board;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.piece=piece;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
board.remove(piece);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
board.validate();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
有棋子=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
棋谱演示类
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//*
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Demon.java
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
import javax.swing.*;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
import java.awt.*;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
import java.awt.event.*;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
import java.util.*;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
public class Demon extends JPanel implements ActionListener,Runnable
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public JButton replay=null,next=null,auto=null,stop=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
LinkedList 棋谱=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Thread 自动演示=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int index=-1;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ChessBoard board=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
JTextArea text;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
JTextField 时间间隔=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int time=1000;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
String 演示过程="";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
JSplitPane splitH=null,splitV=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public Demon(ChessBoard board)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.board=board;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
replay=new JButton("重新演示");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
next=new JButton("下一步");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
auto=new JButton("自动演示");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
stop=new JButton("暂停演示");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
自动演示=new Thread(this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
replay.addActionListener(this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
next.addActionListener(this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
auto.addActionListener(this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
stop.addActionListener(this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
text=new JTextArea();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
时间间隔=new JTextField("1");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
setLayout(new BorderLayout());
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
JScrollPane pane=new JScrollPane(text);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
JPanel p=new JPanel(new GridLayout(3,2));
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
p.add(next);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
p.add(replay);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
p.add(auto);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
p.add(stop);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
p.add(new JLabel("时间间隔(秒)",SwingConstants.CENTER)) ;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
p.add(时间间隔);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
splitV=new JSplitPane(JSplitPane.VERTICAL_SPLIT,pane,p);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
splitH=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,board,splitV);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
splitV.setDividerSize(5);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
splitV.setDividerLocation(400);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
splitH.setDividerSize(5);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
splitH.setDividerLocation(460);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
add(splitH,BorderLayout.CENTER);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
validate();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public void set棋谱(LinkedList 棋谱)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.棋谱=棋谱;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public char numberToLetter(int n)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
char c='
棋谱制作
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//*
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
MakeChessManual.java
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
import javax.swing.*;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
import java.awt.*;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
import java.awt.event.*;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
import java.util.LinkedList;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
public class MakeChessManual extends JPanel implements ActionListener
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
JTextArea text=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
JScrollPane scroll=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ChessBoard board=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ChessPoint[][] point;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
LinkedList 棋谱=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
LinkedList 吃掉的棋子=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
JButton buttonUndo;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int i=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public MakeChessManual(ChessBoard board,ChessPoint[][] point)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.board=board;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.point=point;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
text=new JTextArea();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
scroll=new JScrollPane(text);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
棋谱=new LinkedList();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
吃掉的棋子=new LinkedList();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
buttonUndo=new JButton("悔棋");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
buttonUndo.setFont(new Font("隶书",Font.PLAIN,18));
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
setLayout(new BorderLayout());
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
add(scroll,BorderLayout.CENTER);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
add(buttonUndo,BorderLayout.SOUTH);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
buttonUndo.addActionListener(this);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public char numberToLetter(int n)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
char c='
MoveStep类
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
import java.awt.Point;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
public class MoveStep implements java.io.Serializable
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public Point pStart,pEnd;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public MoveStep(Point p1,Point p2)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
pStart=p1;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
pEnd=p2;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
走棋规则类
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//*
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Rule.java
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
import javax.swing.*;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
import java.awt.*;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
import java.awt.event.*;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
public class Rule
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ChessBoard board=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ChessPiece piece=null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ChessPoint point[][];
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int startI,startJ,endI,endJ,k;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public Rule(ChessBoard board,ChessPoint point[][])
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.board=board;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.point=point;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public boolean movePieceRule(ChessPiece piece,int startI,int startJ,int endI,int endJ)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.piece=piece;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.startI=startI;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.startJ=startJ;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.endI=endI;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.endJ=endJ;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int minI=Math.min(startI,endI);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int maxI=Math.max(startI,endI);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int minJ=Math.min(startJ,endJ);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int maxJ=Math.max(startJ,endJ);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
boolean 可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(piece.getName().equals("车"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{ int i=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(startI>=4&&startI<=6)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(i=startJ-1;i>=1;i--)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[startI][i].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][i].getPiece().getName()).equals("将"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(k=startJ+1;k<=10;k++)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[startI][k].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][k].getPiece().getName()).equals("帅"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(endI==startI)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int j=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(j=minJ+1;j<=maxJ-1;j++)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[startI][j].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
break;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(j==maxJ)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][k].getPiece().getName())!=("帅"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
i=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
break;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(k==11)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
i=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][i].getPiece().getName())!="将")
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
i=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
break;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(i==0)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(startI==endI)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int j=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(j=minJ+1;j<=maxJ-1;j++)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[startI][j].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
break;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(j==maxJ)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else if(startJ==endJ)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int h=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(h=minI+1;h<=maxI-1;h++)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[h][startJ].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
break;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(h==maxI)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(piece.getName().equals("马"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{int t=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int xAxle=Math.abs(startI-endI);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int yAxle=Math.abs(startJ-endJ);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(startI>=4&&startI<=6)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(t=startJ-1;t>=1;t--)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[startI][t].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][t].getPiece().getName()).equals("将"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(k=startJ+1;k<=10;k++)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[startI][k].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][k].getPiece().getName()).equals("帅"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(endI==startI)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][k].getPiece().getName())!=("帅"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
t=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
break;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(k==11)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
t=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][t].getPiece().getName())!="将")
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
t=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
break;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(t==0)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(xAxle==2&&yAxle==1)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(endI>startI)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[startI+1][startJ].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(endI<startI)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[startI-1][startJ].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else if(xAxle==1&&yAxle==2)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(endJ>startJ)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[startI][startJ+1].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(endJ<startJ)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[startI][startJ-1].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(piece.getName().equals("象"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{ int r=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int centerI=(startI+endI)/2;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int centerJ=(startJ+endJ)/2;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int xAxle=Math.abs(startI-endI);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int yAxle=Math.abs(startJ-endJ);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(startI>=4&&startI<=6)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(r=startJ-1;r>=1;r--)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[startI][r].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][r].getPiece().getName()).equals("将"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(k=startJ+1;k<=10;k++)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[startI][k].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][k].getPiece().getName()).equals("帅"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(endI==startI)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][k].getPiece().getName())!=("帅"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
r=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
break;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(k==11)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
r=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][r].getPiece().getName())!="将")
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
r=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
break;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(r==0)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(xAxle==2&&yAxle==2&&endJ<=5)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[centerI][centerJ].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(piece.getName().equals("相"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{ int e=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int centerI=(startI+endI)/2;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int centerJ=(startJ+endJ)/2;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int xAxle=Math.abs(startI-endI);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int yAxle=Math.abs(startJ-endJ);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(startI>=4&&startI<=6)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(e=startJ-1;e>=1;e--)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[startI][e].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][e].getPiece().getName()).equals("将"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(k=startJ+1;k<=10;k++)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[startI][k].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][k].getPiece().getName()).equals("帅"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(endI==startI)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][k].getPiece().getName())!=("帅"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
e=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
break;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(k==11)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
e=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][e].getPiece().getName())!="将")
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
e=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
break;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(e==0)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(xAxle==2&&yAxle==2&&endJ>=6)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[centerI][centerJ].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(piece.getName().equals("炮"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{ int w=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int number=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(startI>=4&&startI<=6)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(w=startJ-1;w>=1;w--)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[startI][w].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][w].getPiece().getName()).equals("将"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(k=startJ+1;k<=10;k++)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[startI][k].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][k].getPiece().getName()).equals("帅"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(startI==endI)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int j=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(j=minJ+1;j<=maxJ-1;j++)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[startI][j].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
number++;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(number>1)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else if(number==1)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[endI][endJ].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else if(number==0&&!point[endI][endJ].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][k].getPiece().getName())!=("帅"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
w=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
break;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(k==11)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
w=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][w].getPiece().getName())!="将")
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
w=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
break;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(w==0)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(startI==endI)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int j=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(j=minJ+1;j<=maxJ-1;j++)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[startI][j].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
number++;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(number>1)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else if(number==1)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[endI][endJ].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else if(number==0&&!point[endI][endJ].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else if(startJ==endJ)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int i=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(i=minI+1;i<=maxI-1;i++)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[i][startJ].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
number++;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(number>1)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else if(number==1)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[endI][endJ].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else if(number==0&&!point[endI][endJ].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(piece.getName().equals("兵"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{ int q=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int xAxle=Math.abs(startI-endI);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int yAxle=Math.abs(startJ-endJ);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(startI>=4&&startI<=6)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(q=startJ-1;q>=1;q--)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[startI][q].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][q].getPiece().getName()).equals("将"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(k=startJ+1;k<=10;k++)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[startI][k].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][k].getPiece().getName()).equals("帅"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(startI==endI)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(startJ-endJ==1&&xAxle==0)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][k].getPiece().getName())!=("帅"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
q=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
break;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(k==11)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
q=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][q].getPiece().getName())!="将")
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
q=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
break;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(q==0)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(endJ>=6)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(startJ-endJ==1&&xAxle==0)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else if(endJ<=5)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((startJ-endJ==1)&&(xAxle==0))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else if((endJ-startJ==0)&&(xAxle==1))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(piece.getName().equals("卒"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{ int u=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int xAxle=Math.abs(startI-endI);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int yAxle=Math.abs(startJ-endJ);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(startI>=4&&startI<=6)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(u=startJ-1;u>=1;u--)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[startI][u].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][u].getPiece().getName()).equals("将"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(k=startJ+1;k<=10;k++)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[startI][k].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][k].getPiece().getName()).equals("帅"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(startI==endI)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(endJ-startJ==1&&xAxle==0)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][k].getPiece().getName())!=("帅"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
u=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
break;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(k==11)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
u=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][u].getPiece().getName())!="将")
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
u=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
break;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(u==0)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(endJ<=5)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(endJ-startJ==1&&xAxle==0)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else if(endJ>=6)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((endJ-startJ==1)&&(xAxle==0))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else if((endJ-startJ==0)&&(xAxle==1))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(piece.getName().equals("士"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{ int p=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int xAxle=Math.abs(startI-endI);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int yAxle=Math.abs(startJ-endJ);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(startI>=4&&startI<=6)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(p=startJ-1;p>=1;p--)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[startI][p].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][p].getPiece().getName()).equals("将"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(k=startJ+1;k<=10;k++)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[startI][k].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][k].getPiece().getName()).equals("帅"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(startI==endI)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][k].getPiece().getName())!=("帅"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
p=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
break;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(k==11)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
p=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[startI][p].getPiece().getName())!="将")
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
p=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
break;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(p==0)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(endI<=6&&endI>=4&&xAxle==1&&yAxle==1)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(piece.getName().equals("帅"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int i;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int xAxle=Math.abs(startI-endI);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int yAxle=Math.abs(startJ-endJ);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(endI==startI)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(endI<=6&&endI>=4&&endJ<=10&&endJ>=8)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((xAxle==1&&yAxle==0)||(xAxle==0&&yAxle==1))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(i=endJ;i>=1;i--)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[endI][i].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[endI][i].getPiece().getName()).equals("将"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(endI<=6&&endI>=4&&endJ<=10&&endJ>=8&&endI!=startI+1&&endI!=startI-1)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((xAxle==1&&yAxle==0)||(xAxle==0&&yAxle==1))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[endI][i].getPiece().getName())!=("将"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(endI<=6&&endI>=4&&endJ<=10&&endJ>=8)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((xAxle==1&&yAxle==0)||(xAxle==0&&yAxle==1))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
break;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(i==0)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(endI<=6&&endI>=4&&endJ<=10&&endJ>=8)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((xAxle==1&&yAxle==0)||(xAxle==0&&yAxle==1))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(piece.getName().equals("将"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int i;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int xAxle=Math.abs(startI-endI);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int yAxle=Math.abs(startJ-endJ);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(endI==startI)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(endI<=6&&endI>=4&&endJ<=3&&endJ>=1)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((xAxle==1&&yAxle==0)||(xAxle==0&&yAxle==1))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(i=endJ;i<=10;i++)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(point[endI][i].isPiece())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[endI][i].getPiece().getName()).equals("帅"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(endI<=6&&endI>=4&&endJ<=3&&endJ>=1&&endI!=startI+1&&endI!=startI-1)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((xAxle==1&&yAxle==0)||(xAxle==0&&yAxle==1))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((point[endI][i].getPiece().getName())!=("帅"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(endI<=6&&endI>=4&&endJ<=3&&endJ>=1)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((xAxle==1&&yAxle==0)||(xAxle==0&&yAxle==1))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
break;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(i==11)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(endI<=6&&endI>=4&&endJ<=3&&endJ>=1)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if((xAxle==1&&yAxle==0)||(xAxle==0&&yAxle==1))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
可否走棋=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return 可否走棋;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
单机中国象棋(Java版)相关推荐
- 中国象棋(Java版)
版本1.0 程序简介: 如果程序运行之后报错 ,一般是由于JDK版本不同的原因,我使用的是JDK1.7,因为在JDK1.7中加入了Swicth(String)即可以对字符串进行切换, 所以会出如下问题 ...
- Java实现中国象棋(联机版)
Java实现中国象棋(联机版) 该版本的中国象棋,程序有点复杂,是基于网络通信的基础上实现的.由于代码带太长,我这里就只做简单的演示,下面会给出链接地址的. 一.程序结构: 客户端: 服务端: 二.操 ...
- Java游戏开发——中国象棋联机版
游戏介绍: 中国象棋是起源于中国的一种棋戏,属于二人对抗性游戏的一种,在中国有着悠久的历史.由于规则简单,趣味性强,成为流行极为广泛的棋类游戏. 中国象棋使用方形格状棋盘及红黑二色圆形棋子进行对弈,棋 ...
- java象棋实验报告_中国象棋java程序设计实验报告
中国象棋java程序设计实验报告 东北大学秦皇岛分校信息与计算科学系Java 程序设计实验报告专业名称 信 息 与 计 算 科 学班级学号 7080206学生姓名 彭 军指导教师 王 薇完成时间 20 ...
- java象棋实验报告_中国象棋java程序设计实验报告.doc
中国象棋java程序设计实验报告.doc 东北大学秦皇岛分校 信息与计算科学系 Java 程序设计实验报告 专业名称 信息与计算科学 班级学号 7080206 学生姓名 彭 军 指导教师 王薇 完成时 ...
- 教你怎么用Python和Qt5编写中国象棋AI版——规则模块
提示:该模块用于实现规则模块 教你怎么用Python和Qt5编写中国象棋AI版--规则模块 前言 一.中国象棋大致规则? 二.各棋子规则实现思路 1.兵 注意事项 过河兵合法偏移 未过河兵合法偏移 2 ...
- 教你怎么用Python和Qt5编写中国象棋AI版——简明易懂版
教你怎么用Python和Qt5编写中国象棋AI版--简明易懂版 一.前言 二.中国象棋的几个模块--作者认为的 三.各模块大致实现思路 四.最后 一.前言 大家学习Python是否有过编写一个稍微大型 ...
- 中国象棋java着算法_Java中国象棋博弈程序探秘[4]——生成有效着法
生成有效着法 转载请保留作者信息: 作者:88250 MSN & Gmail & QQ:DL88250@gmail.com 着法生成就是要产生所有有效的着法,让电脑棋手在这些着法中选择 ...
- 中国象棋java算法_Java中国象棋博弈程序探秘[5]——搜索算法
搜索算法 转载请保留作者信息: 作者:88250 MSN & Gmail & QQ:DL88250@gmail.com 搜索是电脑棋手AI的核心,有效的搜索算法很关键.本文给出了一些常 ...
最新文章
- 微服务治理实践 | 金丝雀发布
- layer output 激活函数_一文彻底搞懂BP算法:原理推导+数据演示+项目实战(下篇)...
- Linux(Contos7.5)环境搭建之Gitblit安装(三)
- HDU 5119 Happy Matt Friends(递推)
- 11/100. Convert BST to Greater Tree
- JS----JavaScript数组去重(12种方法,史上最全)
- mongoose mysql_mongoose入门
- mpandroidchart 设置x轴数据_Flowjo软件下的流式数据基本分析
- 「管理数学基础」1.3 矩阵理论:特征值与特征向量
- python 错误代码_[python]WindowsError的错误代码详解
- DPDK之KNI原理
- eclipse angularjs 插件安装
- spss连接mysql
- 小白刷LeeCode(算法篇)6
- 高龄白菜java学习第109天(java数据结构和算法(27))
- NCBI RefSeq命名格式的详细说明
- 【Java面试题】有三个线程 t1,t2,t3,怎么确保它们按顺序执行?
- 最大公因数等于 K 的子数组数目求解全过程
- kali域名无法暂时解析 无法网络
- ucinet三天写论文! 分组密度;EI指数实战
热门文章
- java new数组对象数组_java的new数组,对数组里每个对象必须再实例化
- FFmpeg CENC加密mp4文件
- 大规模中文文本处理中的自动切词和标注技术
- 数字IC手撕代码-边沿检测(上升沿、下降沿、双边沿)
- 微软公司内部培训程序员资料---求解线性方程组的类
- docker使用buildx构建不同架构镜像
- 软考高项:英语专题及真题
- php上传视频文件怎么实现
- 国际数据挖掘顶会 KDD 2019 研究方向亚军论文《Optimizing Impression Counts for Outdoor Advertising》解读
- 全球27所大学开设区块链课程,这门课究竟该教什么?