Philippe229/risk

Part 1: Game Statistics Observer Decorator

Closed this issue · 0 comments

pbgnz commented

(Extension of Part 3 of Assignment 3) Using the Observer design pattern, implement a view that displays some useful statistics about the game as it is being played. This should dynamically be updated as various aspect of the game state changes and be visible at all times during game play. Using the Decorator pattern, provide different decorators that add more information to be displayed on the Basic (undecorated) Game Statistics Observer:

  1. Basic (undecorated) Game Statistics Observer: Display the turn number, update the view every time a
    new turn starts.
  2. Player Domination Observer Decorator: Display the percentage of countries owned by each player,
    update the view when any player conquers a country.
  3. Player Hands Observer Decorator: Display the cards owned by every player, update the view when any
    player’s hand is changing.
  4. Continent Control Observer Decorator: Display what player controls each continent, update the view
    when any continent becomes controlled by a player, or when a player loses control of a continent.

You must be able to demonstrate that the Basic (undecorated) Game Statistics Observer is available at all times during play and updates the view when the turn number increases. Before the beginning of every turn, the user should be given the opportunity to add one or more Decorators (2, 3, or 4) above, which should result in the Observer to show more information and be notified as instructed above for each Decorator. Each Decorator (2,3,4) should not be used more than once. The user should also be allowed to remove Decorators. The user should be allowed to specify that it does not want to add/remove Decorators in the future, after which the user shall not be prompted anymore at the beginning of every turn.