Use cases for color guessing game

In order to practice APOO I'm trying to apply use cases to a simple color guessing game.

Here would be it visually. The user can try to guess as many times as he wants, or restart the game by clicking "Reset".

Guess the color

While simple, it seems like three use cases fit here:

Start Game

  1. game secretly chooses a random color from three available.
  2. game displays neutral color (gray).

Play game

Precondition: game started

  1. player chooses a color from three available.
  2. game displays chosen color.
  3. if color equal to the hidden, informs that the player has won.
  4. if color different from the hidden, informs that the player lost.
  5. player can repeat the move (Step 1) as many times as he wants.

Restart game

  1. player requests start again game.
  2. use case start Game becomes available.

I have three questions:

  • Are the use cases well (correctly) defined?

  • Player is an actor (external to the system); game is also an actor? How does the use case diagram look in this case (would an actor be within the bounds of the system, for example)?

  • In restart game , another use case is called. Actually this use case it needs to be called every time the application starts. How do I represent this in the use case diagram? Or is this not correct(should it be just a precondition, for example)?

Author: Comunidade, 2020-04-25

1 answers

  1. No, they're not well defined. The system should not be its own actor. The player makes sense to be an actor and his two use cases are correct, bring something of value to the same: play game and restart game.

  2. And 3. The use case start game does not make sense. It should be a constraint (a precondition) of the other two use cases.

 0
Author: Piovezan, 2020-04-27 02:32:58