//每当落子后,判断胜负 bool ChessBoard::judgeVictory(Chess& lastchess) { int row = lastchess.getRow(); int column = lastchess.getColumn(); int type = lastchess.getChessType(); //垂直方向 if(fiveInDirection(row, column, type, VERTICAL)) { return VICTORY; } //水平方向 if(fiveInDirection(row, column, type, HORIZON)) { return VICTORY; } //右斜方向 if(fiveInDirection(row, column, type, RIGHT)) { return VICTORY; } //左斜方向 if(fiveInDirection(row, column, type, LEFT)) { return VICTORY; } return CONTINUE; }
//指定一个棋子 void ChessBoard::setOneChess(Chess chess) { int row = chess.getRow(); int column = chess.getColumn(); this->chessboardmat[row][column] = chess.getChessType(); steps.push_back(chess); }