0

Assume I have the following class:

public class Player {
private Board board;
private int roundsPlayed = 0;

public void play() {
    while (board.isAvailable() && roundsPlayed < 10) {
        // playing on the board
        roundsPlayed++;
    }
}
}

What is the Pre/Post condition of my Player's play() method ?

My answer for the precondition would be centered around the roundsPlayed variable,

However I'm wondering whether or not my pre/post condition should include the fact that I'm using the Board and probably its variables in my method

Should my pre / post condition consider Board in my answer ?

shaqed
  • 342
  • 3
  • 17

1 Answers1

0

Yes, you have a precondition that board is not null.

Gili
  • 86,244
  • 97
  • 390
  • 689