假设我有以下课程:
public class Player {
private Board board;
private int roundsPlayed = 0;
public void play() {
while (board.isAvailable() && roundsPlayed < 10) {
// playing on the board
roundsPlayed++;
}
}
}
我Player
的play()
方法的前置/后置条件是什么?
我对前提条件的回答将以roundsPlayed
变量为中心,
但是我想知道我的前置/后置条件是否应该包括我Board
在我的方法中使用 the 和可能它的变量的事实
我的回答中是否应该考虑我的前置/后置条件Board
?