Exemple #1
0
 public ChessBoard copyBoard(bool revese)//revese表示复制的是对方的棋盘
 {
     ChessBoard board = new ChessBoard();
     for (short i = 0; i < 10; ++i)
         board.chesses[i] = new Chess(this.chesses[i]);
     for (short i = 0; i < 5; ++i)
         for (short k = 0; k < 5; ++k)
             board.locations[i][k] = this.locations[i][k];
     if (revese)
         for (short i = 0; i < 10; ++i)
             board.chesses[i].isMine = !board.chesses[i].isMine;
     board.lastBoard = this.lastBoard;
     return board;
 }
Exemple #2
0
        public void moveChess(int pos)
        {
            if (selected > -1 && selected < 10)
            {
                lastBoard = copyBoard(false);//在走之前将原来的棋盘复制一份

                locations[chesses[selected].x][chesses[selected].y] = -1;
                chesses[selected].setOldPos();
                chesses[selected].x = pos % 5;
                chesses[selected].y = pos / 5;
                locations[chesses[selected].x][chesses[selected].y] = selected;
                int checkIndex = selected;
                selected = -1;

                //走完开始判断夹挑
                new Thread((ThreadStart)delegate() { checkJaTiao(checkIndex, true); }).Start();
            }
        }