0% found this document useful (0 votes)
23 views3 pages

Game Class Structure Overview

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)
23 views3 pages

Game Class Structure Overview

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

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()

+getPlayer()
+getBoard()
+getCurrentPlayer()
+setCurrentPlayer(player: Player)
}

class Board {
-spaces: List<Space>
-updateSpace(space: Space)
-getPropertyLocation(property: Property): int

+getSpace(location: int): Space


+getPropertyLocation(property: Property): int
}

class Space {
-type: SpaceType
-location: int

+getType(): SpaceType
+getLocation(): int
+checkLandingSpace(player: Player): Space
}

class Property {
-name: string
-owner: Player
-price: int
-rent: int

+getName(): string
+getOwner(): Player
+getPrice(): int
+getRent(): int
+setOwner(owner: Player)
+isUnowned(): boolean
}

class Fee {
-name: string
-amount: int

+getName(): string
+getAmount(): int
}

class Trivia {
-type: QuestionType
-description: string
-effect: QuizEffect

+getType(): QuestionType
+getDescription(): string
+getEffect(): QuizEffect
}

enum SpaceType {
PROPERTY
CHANCE
QUIZ_QUESTION
FEE
JAIL
GO_TO_JAIL
}

enum QuestionType {
CHANCE
QUIZ_QUESTION
}

enum QuizEffect {
MOVE_SPACES
GAIN_MONEY
LOSE_MONEY
GO_TO_JAIL
GET_OUT_OF_JAIL_FREE
}

class Player {
-name: string
-balance: int
-currentSpace: Space
-isInJail: boolean
-jailTurns: int
-getOutOfJailFreeCards: int

+getName(): string
+getBalance(): int
+getCurrentSpace(): Space
+setCurrentSpace(space: Space)
+isInJail(): boolean
+setIsInJail(inJail: boolean)
+getJailTurns(): int
+setJailTurns(turns: int)
+hasGetOutOfJailFreeCard(): boolean
+addGetOutOfJailFreeCard()
+useGetOutOfJailFreeCard()
+payRent(property: Property)
+updateBalance(balance: int)
}

Game --> Board


Game --> Player
Game *--> Space
Game *--> Fee
Game *--> Trivia

Board *--> Space


Property --> Player
Space --> Player
Trivia --> Player

Player --> Dice: rollDice()


Dice --> Player: return rolled number

Game --> Admin: checkWinCondition()


Admin --> Game: return winner

Player --> Game: getCurrentPlayer()


Game --> Player: setCurrentPlayer(player: Player)

Game --> Board: getPropertyLocation(currentSpace)


Board --> Space: getSpace(location: int)
Space --> Player: checkLandingSpace(player: Player)

Game --> Card: drawCard()


Card --> Game: return drawn card

Game --> Player: chooseToBuyProperty(property: Property)


Player --> Game: payRent(property: Property)
Player --> Game: addGetOutOfJailFreeCard()
Player --> Game: useGetOutOfJailFreeCard()
Player --> Game: rollDice()
Player --> Game: payFee(fee: Fee)
Player --> Game: updateBalance(balance: int)

Game --> Admin: checkWinCondition()


Admin --> Game: return winner

You might also like