haive.games.monopoly.utils¶
Monopoly game utilities and board logic.
- This module provides utility functions for the monopoly game, including:
Board setup and property definitions
Game logic calculations
Card definitions and handling
Rent calculations
Functions¶
|
Calculate rent for a property. |
|
Check if two properties can be traded. |
|
Check if the game should end. |
Create the initial board with all properties. |
|
|
Create initial players. |
|
Calculate cost to build houses or hotel. |
|
Get all property names for a color group. |
|
Get property information at a board position. |
|
Handle special board positions like GO, Jail, etc. |
|
Move a player based on dice roll. |
Roll two dice. |
|
Shuffle and return chance and community chest cards. |
Module Contents¶
- haive.games.monopoly.utils.calculate_rent(property, state, dice_roll=None)[source]¶
Calculate rent for a property.
- haive.games.monopoly.utils.can_trade_properties(prop1, prop2, state)[source]¶
Check if two properties can be traded.
- Parameters:
prop1 (haive.games.monopoly.models.Property)
prop2 (haive.games.monopoly.models.Property)
state (haive.games.monopoly.state.MonopolyState)
- Return type:
- haive.games.monopoly.utils.get_building_cost(property, buildings, is_hotel=False)[source]¶
Calculate cost to build houses or hotel.
- haive.games.monopoly.utils.get_properties_by_color(color)[source]¶
Get all property names for a color group.
- haive.games.monopoly.utils.get_property_at_position(position)[source]¶
Get property information at a board position.
- haive.games.monopoly.utils.handle_special_position(position, player, state)[source]¶
Handle special board positions like GO, Jail, etc.
- haive.games.monopoly.utils.move_player(player, dice_roll)[source]¶
Move a player based on dice roll.