Question

I am pretty new to modelling (I'm 15). I am learning activity diagrams and use cases along with UML but I cannot figure out how to correctly model this situation: Player 1 makes a move Player 2 makes a move Game ends when player cannot move

I designed a loop but it contains two GAME OVER decisions after each player move and it does not seems right to me.

I have:

Player 1 -- > MOVE -- > MOVES AVAILABLE? Yes --> GO TO Player 2, No -- GAME OVER
Player 2- - > MOVE -- > MOVES AVAILABLE? Yes --> GO TO Player 1, No -- GAME OVER

But I think I cannot place the GAME OVER evaulation elsewhere because it can happen after either player's turn. Am I on the right track?

Was it helpful?

Solution

I think it helps to think of there being two separate GAME OVER states, Player1Wins and Player2Wins. Then it is right to have two separate evaluations of game over.

Similarly there are two separate MOVES AVAILABLE evaluations, depending upon whose turn will be next.

|->Player 1 moves
|   |
|  P2 Moves Available -- no --> Player1Wins
|   |
|  yes
|   \/
|  Player 2 moves
|   |
|  P1 Moves available -- no --> Player2Wins
|   |
|--yes
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top