0% found this document useful (0 votes)
9 views2 pages

Class Diagram

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

Class Diagram

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

class Game {

-board: Board
-players: List<Player>
-currentPlayer: Player
+startGame()
-initializeBoard()
+playGame()
-playerRollDice(player: Player): int
-movePlayerPiece(player: Player, spaces: int)
-checkLandingSpace(player: Player): Space
-buyProperty(player: Player, property: Property)
-payRent(player: Player, property: Property)
-drawCard(): Card
-applyCardEffects(player: Player, card: Card)
-payFee(player: Player, fee: Fee)
-goToJail(player: Player)
-useGetOutOfJailFreeCard(player: Player, card: Card)
-attemptRollDoubles(player: Player): boolean
-releaseFromJail(player: Player)
-endTurn()
-checkWinCondition(): Player
+endGame()
}
class Board {
-spaces: List<Space>
-updateSpace(space: Space)
-getPropertyLocation(property: Property): int
}
class Space {
-type: SpaceType
}
class Property {
-name: string
-owner: Player
-price: int
-rent: int
}
class Fee {
-name: string
-amount: int
}
class Card {
-type: CardType
-description: string
-effect: CardEffect
}
enum SpaceType {
PROPERTY
CHANCE
COMMUNITY_CHEST
FEE
JAIL
GO_TO_JAIL
}
enum CardType {
CHANCE
COMMUNITY_CHEST
}
enum CardEffect {
MOVE_SPACES
GAIN_MONEY
LOSE_MONEY
GO_TO_JAIL
GET_OUT_OF_JAIL_FREE
}
class Player {
-name: string
-balance: int
-currentSpace: int
-isInJail: boolean
-jailTurns: int
-hasGetOutOfJailFreeCard: boolean
+rollDice(): int
+chooseToBuyProperty(property: Property): boolean
+chooseToUseGetOutOfJailFreeCard(card: Card): boolean
}
Game --> Board
Game --> Player
Game *--> Space
Game *--> Fee
Game *--> Card
Board *--> Space
Player --> Card
Property --> Player

You might also like