Monopoly — Portage moderne 0.1.0
Portage moderne C/C++23 du Monopoly de 1999
Loading...
Searching...
No Matches
monopoly::ai::decision Namespace Reference

Classes

struct  AuctionBidConfig
 
struct  CounterProposalBalanceConfig
 
struct  CounterProposalBalanceResult
 
struct  CounterProposalPreflightConfig
 
struct  CounterProposalPreflightInputs
 
struct  CounterProposalPreflightResult
 
struct  CounterProposalSession
 
struct  EconomicActionPlan
 
struct  FairTradeConfig
 
struct  MonopolyProposalConfig
 
struct  ProactiveTradeInputs
 
struct  ProactiveTradeResult
 
struct  SemiImportantTradeInputs
 
struct  TradeEvaluationConfig
 
struct  WinningChanceConfig
 
struct  WorthFactors
 

Enumerations

enum class  CashStrategy : std::uint8_t {
  MinimumAmount = 0 , ExpectedRentIncludingMonopolies , ExpectedRentExcludingMonopolies , HighestRent ,
  MonopolyDependent , Count
}
 
enum class  HousePurchaseDecision : std::uint8_t { No = 0 , Yes = 1 , Later = 2 }
 
enum class  EconomicActionKind : std::uint8_t {
  None = 0 , MortgageProperty , UnmortgageProperty , BuyHouse ,
  SellBuilding
}
 
enum class  HousingAuctionBuilding : std::uint8_t { House = 0 , Hotel }
 
enum class  JailExitChoice : std::uint8_t { Roll = 0 , Pay = 1 , Card = 2 }
 
enum class  ProactiveTradeKind : std::uint8_t {
  None = 0 , GiveMonopolyForCash , AcquireMonopoly , SemiImportant ,
  NeedsSemiImportant
}
 
enum class  CounterProposalStatus : std::uint8_t {
  Ready = 0 , InvalidInput , InvalidTime , NotInvolved ,
  FutureOrImmunity , TooManyCounters , RepeatedProperties , ProbabilitySkipped ,
  NotSeriousTrader , NoTradePartners , AnnoyedWithTrader
}
 
enum class  CounterProposalBalanceStatus : std::uint8_t {
  Ready = 0 , InvalidInput , TooPoor , CouldNotReturnMonopoly ,
  Unaffordable , Improper
}
 

Functions

std::int64_t excessCashAvailable (const rules::GameState &state, rules::PlayerNumber player, bool cashOnly, CashStrategy strategy, std::int64_t minCashOnHand, std::int64_t moneyOwed) noexcept
 
std::int64_t cashAvailableAfterHousing (const rules::GameState &state, rules::PlayerNumber player, CashStrategy strategy, std::int64_t minCashOnHand, std::int64_t moneyOwed) noexcept
 
bool shouldBuyProperty (const rules::GameState &state, rules::PlayerNumber player, rules::board::SquareType property, CashStrategy strategy, std::int64_t minCashOnHand, std::span< const std::int64_t > moneyOwed) noexcept
 
bool hypotheticalBuyHouse (rules::GameState &state, rules::PlayerNumber player, std::int64_t moneyOwed) noexcept
 
rules::board::SquareType hypotheticalUnmortgageMonopolyProperty (rules::GameState &state, rules::PlayerNumber player, CashStrategy strategy, std::int64_t minCashOnHand, std::int64_t moneyOwed) noexcept
 
rules::board::SquareType hypotheticalUnmortgageProperty (rules::GameState &state, rules::PlayerNumber player, bool onlyMonopolies, CashStrategy strategy, std::int64_t minCashOnHand, std::int64_t moneyOwed) noexcept
 
bool shouldUnmortgageProperty (const rules::GameState &state, rules::PlayerNumber player, CashStrategy strategy, std::int64_t minCashOnHand, std::int64_t moneyOwed) noexcept
 
HousePurchaseDecision shouldBuyHouse (const rules::GameState &state, rules::PlayerNumber player, CashStrategy strategy, std::int64_t minCashOnHand, std::uint8_t housingPurchaseStrategy, std::int64_t moneyOwed) noexcept
 
EconomicActionPlan planBuyHouseAction (const rules::GameState &state, rules::PlayerNumber player, CashStrategy strategy, std::int64_t minCashOnHand, std::uint8_t housingPurchaseStrategy, std::int64_t moneyOwed) noexcept
 
std::optional< rules::board::SquareType > chooseHousingAuctionSquare (const rules::GameState &state, rules::PlayerNumber player, HousingAuctionBuilding building, CashStrategy strategy, std::int64_t minCashOnHand, rules::board::PropertySet legalSquares, bool reservedBuilding, std::int64_t moneyOwed) noexcept
 
EconomicActionPlan planUnmortgagePropertyAction (const rules::GameState &state, rules::PlayerNumber player, CashStrategy strategy, std::int64_t minCashOnHand, std::int64_t moneyOwed) noexcept
 
std::optional< bool > chooseFractionTax (const rules::GameState &state, rules::PlayerNumber player) noexcept
 
std::optional< JailExitChoice > chooseJailExitChoice (const rules::GameState &state, rules::PlayerNumber player, bool canRollDoubles, bool canPayFee, bool canUseCard) noexcept
 
std::int64_t totalWorthWithFactors (const rules::GameState &state, rules::PlayerNumber player, const WorthFactors &factors) noexcept
 
bool mortgageWorstProperty (rules::GameState &state, rules::PlayerNumber player, bool sellHouses, bool mortgageMonopoly) noexcept
 
EconomicActionPlan planHouseSaleAction (const rules::GameState &state, rules::board::SquareType referenceSquare) noexcept
 
EconomicActionPlan planDebtLiquidationStep (const rules::GameState &state, rules::PlayerNumber player, bool sellHouses) noexcept
 
void mortgageNegativeCashPlayers (rules::GameState &state) noexcept
 
double evaluateWinningChances (const rules::GameState &state, rules::PlayerNumber player, const WinningChanceConfig &config, std::span< double > savePlayerChances) noexcept
 
double evaluateTrade (const rules::GameState &state, rules::PlayerNumber player, rules::PlayerNumber strategyPlayer, const ai::trade::TradeProposalList &proposals, const TradeEvaluationConfig &config) noexcept
 
std::int64_t tradeBidForProperty (const rules::GameState &state, rules::PlayerNumber player, rules::board::SquareType property, std::int64_t currentBid, rules::PlayerNumber currentBidder, const AuctionBidConfig &config) noexcept
 
std::int64_t bidForAuctionItem (const rules::GameState &state, rules::PlayerNumber player, rules::board::SquareType item, std::int64_t currentBid, rules::PlayerNumber currentBidder, const AuctionBidConfig &config, bool useTenDollarIncrement) noexcept
 
void evaluateTradePlayerList (const rules::GameState &state, std::span< const rules::PlayerNumber > players, rules::PlayerNumber strategyPlayer, const ai::trade::TradeProposalList &proposals, bool givingMonopolyForCash, const TradeEvaluationConfig &config, std::span< double > evaluations) noexcept
 
bool makeTradeFair (const rules::GameState &state, rules::PlayerNumber player, std::span< const rules::PlayerNumber > partners, std::int64_t giveMost, bool givingMonopoly, ai::trade::TradeProposalList &proposals, const FairTradeConfig &config, std::span< const ai::trade::FutureImmunityRecord > immunities) noexcept
 
bool buildMonopolyTrade (const rules::GameState &state, rules::PlayerNumber player, rules::board::SquareGroup group, std::span< const rules::PlayerNumber > partners, const ai::trade::PropertySets &properties, ai::trade::TradeProposalList &proposals, const MonopolyProposalConfig &config) noexcept
 
bool buildMonopolyForCash (const rules::GameState &state, rules::PlayerNumber player, rules::PlayerNumber firstPartner, const ai::trade::PropertySets &properties, ai::trade::TradeProposalList &proposals, const MonopolyProposalConfig &config) noexcept
 
bool buildSemiImportantTrade (const rules::GameState &state, rules::PlayerNumber player, std::span< const double > playerAttitudes, const ai::trade::PropertySets &properties, const SemiImportantTradeInputs &inputs, ai::trade::TradeProposalList &proposals, const MonopolyProposalConfig &config) noexcept
 
ProactiveTradeResult buildProactiveTrade (const rules::GameState &state, rules::PlayerNumber player, std::span< const double > playerAttitudes, const ai::trade::PropertySets &properties, const ProactiveTradeInputs &inputs, const MonopolyProposalConfig &config) noexcept
 
CounterProposalPreflightResult counterProposalPreflight (const rules::GameState &state, rules::PlayerNumber player, const ai::trade::TradeProposalList &currentTrade, const CounterProposalPreflightInputs &inputs, const CounterProposalPreflightConfig &config, CounterProposalSession &session, std::span< const ai::trade::FutureImmunityRecord > immunities) noexcept
 
CounterProposalBalanceResult counterProposalBalance (const rules::GameState &state, rules::PlayerNumber player, const CounterProposalPreflightResult &preflight, ai::trade::TradeProposalList &proposals, const CounterProposalBalanceConfig &config, std::span< const ai::trade::FutureImmunityRecord > immunities) noexcept
 
bool shouldGiveAwayMonopoly (const rules::GameState &state, rules::PlayerNumber player, CashStrategy strategy, std::int64_t minCashOnHand, int maxHousesPerSquareForGiveAway, std::span< const std::int64_t > moneyOwed) noexcept
 

Variables

constexpr std::array< double, 8 > MonopolyAverageLandingFrequency
 
constexpr std::uint8_t CriticalHousingLevel = 3
 
constexpr std::uint8_t HouseBuyAtLeast3 = 1u << 0
 
constexpr std::uint8_t HouseBuyWithin12 = 1u << 1
 

Enumeration Type Documentation

◆ CashStrategy

enum class monopoly::ai::decision::CashStrategy : std::uint8_t
strong
Enumerator
MinimumAmount 
ExpectedRentIncludingMonopolies 
ExpectedRentExcludingMonopolies 
HighestRent 
MonopolyDependent 
Count 

Definition at line 13 of file AIDecisionUtility.hpp.

◆ CounterProposalBalanceStatus

Enumerator
Ready 
InvalidInput 
TooPoor 
CouldNotReturnMonopoly 
Unaffordable 
Improper 

Definition at line 415 of file AIDecisionUtility.hpp.

◆ CounterProposalStatus

Enumerator
Ready 
InvalidInput 
InvalidTime 
NotInvolved 
FutureOrImmunity 
TooManyCounters 
RepeatedProperties 
ProbabilitySkipped 
NotSeriousTrader 
NoTradePartners 
AnnoyedWithTrader 

Definition at line 357 of file AIDecisionUtility.hpp.

◆ EconomicActionKind

Enumerator
None 
MortgageProperty 
UnmortgageProperty 
BuyHouse 
SellBuilding 

Definition at line 96 of file AIDecisionUtility.hpp.

◆ HousePurchaseDecision

Enumerator
No 
Yes 
Later 

Definition at line 78 of file AIDecisionUtility.hpp.

◆ HousingAuctionBuilding

Enumerator
House 
Hotel 

Definition at line 124 of file AIDecisionUtility.hpp.

◆ JailExitChoice

enum class monopoly::ai::decision::JailExitChoice : std::uint8_t
strong
Enumerator
Roll 
Pay 
Card 

Definition at line 160 of file AIDecisionUtility.hpp.

◆ ProactiveTradeKind

Enumerator
None 
GiveMonopolyForCash 
AcquireMonopoly 
SemiImportant 
NeedsSemiImportant 

Definition at line 325 of file AIDecisionUtility.hpp.

Function Documentation

◆ bidForAuctionItem()

std::int64_t monopoly::ai::decision::bidForAuctionItem ( const rules::GameState &  state,
rules::PlayerNumber  player,
rules::board::SquareType  item,
std::int64_t  currentBid,
rules::PlayerNumber  currentBidder,
const AuctionBidConfig &  config,
bool  useTenDollarIncrement 
)
noexcept

Definition at line 1564 of file AIDecisionUtility.cpp.

◆ buildMonopolyForCash()

bool monopoly::ai::decision::buildMonopolyForCash ( const rules::GameState &  state,
rules::PlayerNumber  player,
rules::PlayerNumber  firstPartner,
const ai::trade::PropertySets &  properties,
ai::trade::TradeProposalList &  proposals,
const MonopolyProposalConfig &  config 
)
noexcept

Definition at line 1954 of file AIDecisionUtility.cpp.

◆ buildMonopolyTrade()

bool monopoly::ai::decision::buildMonopolyTrade ( const rules::GameState &  state,
rules::PlayerNumber  player,
rules::board::SquareGroup  group,
std::span< const rules::PlayerNumber >  partners,
const ai::trade::PropertySets &  properties,
ai::trade::TradeProposalList &  proposals,
const MonopolyProposalConfig &  config 
)
noexcept

Definition at line 1901 of file AIDecisionUtility.cpp.

◆ buildProactiveTrade()

ProactiveTradeResult monopoly::ai::decision::buildProactiveTrade ( const rules::GameState &  state,
rules::PlayerNumber  player,
std::span< const double >  playerAttitudes,
const ai::trade::PropertySets &  properties,
const ProactiveTradeInputs &  inputs,
const MonopolyProposalConfig &  config 
)
noexcept

Definition at line 2177 of file AIDecisionUtility.cpp.

◆ buildSemiImportantTrade()

bool monopoly::ai::decision::buildSemiImportantTrade ( const rules::GameState &  state,
rules::PlayerNumber  player,
std::span< const double >  playerAttitudes,
const ai::trade::PropertySets &  properties,
const SemiImportantTradeInputs &  inputs,
ai::trade::TradeProposalList &  proposals,
const MonopolyProposalConfig &  config 
)
noexcept

Definition at line 1998 of file AIDecisionUtility.cpp.

◆ cashAvailableAfterHousing()

std::int64_t monopoly::ai::decision::cashAvailableAfterHousing ( const rules::GameState &  state,
rules::PlayerNumber  player,
CashStrategy  strategy,
std::int64_t  minCashOnHand,
std::int64_t  moneyOwed 
)
noexcept

Definition at line 116 of file AIDecisionUtility.cpp.

◆ chooseFractionTax()

std::optional< bool > monopoly::ai::decision::chooseFractionTax ( const rules::GameState &  state,
rules::PlayerNumber  player 
)
noexcept

Definition at line 991 of file AIDecisionUtility.cpp.

◆ chooseHousingAuctionSquare()

std::optional< rules::board::SquareType > monopoly::ai::decision::chooseHousingAuctionSquare ( const rules::GameState &  state,
rules::PlayerNumber  player,
HousingAuctionBuilding  building,
CashStrategy  strategy,
std::int64_t  minCashOnHand,
rules::board::PropertySet  legalSquares,
bool  reservedBuilding,
std::int64_t  moneyOwed 
)
noexcept

Definition at line 759 of file AIDecisionUtility.cpp.

◆ chooseJailExitChoice()

std::optional< JailExitChoice > monopoly::ai::decision::chooseJailExitChoice ( const rules::GameState &  state,
rules::PlayerNumber  player,
bool  canRollDoubles,
bool  canPayFee,
bool  canUseCard 
)
noexcept

Definition at line 1003 of file AIDecisionUtility.cpp.

◆ counterProposalBalance()

CounterProposalBalanceResult monopoly::ai::decision::counterProposalBalance ( const rules::GameState &  state,
rules::PlayerNumber  player,
const CounterProposalPreflightResult &  preflight,
ai::trade::TradeProposalList &  proposals,
const CounterProposalBalanceConfig &  config,
std::span< const ai::trade::FutureImmunityRecord >  immunities 
)
noexcept

Definition at line 2401 of file AIDecisionUtility.cpp.

◆ counterProposalPreflight()

CounterProposalPreflightResult monopoly::ai::decision::counterProposalPreflight ( const rules::GameState &  state,
rules::PlayerNumber  player,
const ai::trade::TradeProposalList &  currentTrade,
const CounterProposalPreflightInputs &  inputs,
const CounterProposalPreflightConfig &  config,
CounterProposalSession &  session,
std::span< const ai::trade::FutureImmunityRecord >  immunities 
)
noexcept

Definition at line 2309 of file AIDecisionUtility.cpp.

◆ evaluateTrade()

double monopoly::ai::decision::evaluateTrade ( const rules::GameState &  state,
rules::PlayerNumber  player,
rules::PlayerNumber  strategyPlayer,
const ai::trade::TradeProposalList &  proposals,
const TradeEvaluationConfig &  config 
)
noexcept

Definition at line 1437 of file AIDecisionUtility.cpp.

◆ evaluateTradePlayerList()

void monopoly::ai::decision::evaluateTradePlayerList ( const rules::GameState &  state,
std::span< const rules::PlayerNumber >  players,
rules::PlayerNumber  strategyPlayer,
const ai::trade::TradeProposalList &  proposals,
bool  givingMonopolyForCash,
const TradeEvaluationConfig &  config,
std::span< double >  evaluations 
)
noexcept

Definition at line 1681 of file AIDecisionUtility.cpp.

◆ evaluateWinningChances()

double monopoly::ai::decision::evaluateWinningChances ( const rules::GameState &  state,
rules::PlayerNumber  player,
const WinningChanceConfig &  config,
std::span< double >  savePlayerChances 
)
noexcept

Definition at line 1307 of file AIDecisionUtility.cpp.

◆ excessCashAvailable()

std::int64_t monopoly::ai::decision::excessCashAvailable ( const rules::GameState &  state,
rules::PlayerNumber  player,
bool  cashOnly,
CashStrategy  strategy,
std::int64_t  minCashOnHand,
std::int64_t  moneyOwed 
)
noexcept

Definition at line 63 of file AIDecisionUtility.cpp.

◆ hypotheticalBuyHouse()

bool monopoly::ai::decision::hypotheticalBuyHouse ( rules::GameState &  state,
rules::PlayerNumber  player,
std::int64_t  moneyOwed 
)
noexcept

Definition at line 253 of file AIDecisionUtility.cpp.

◆ hypotheticalUnmortgageMonopolyProperty()

rules::board::SquareType monopoly::ai::decision::hypotheticalUnmortgageMonopolyProperty ( rules::GameState &  state,
rules::PlayerNumber  player,
CashStrategy  strategy,
std::int64_t  minCashOnHand,
std::int64_t  moneyOwed 
)
noexcept

Definition at line 369 of file AIDecisionUtility.cpp.

◆ hypotheticalUnmortgageProperty()

rules::board::SquareType monopoly::ai::decision::hypotheticalUnmortgageProperty ( rules::GameState &  state,
rules::PlayerNumber  player,
bool  onlyMonopolies,
CashStrategy  strategy,
std::int64_t  minCashOnHand,
std::int64_t  moneyOwed 
)
noexcept

Definition at line 419 of file AIDecisionUtility.cpp.

◆ makeTradeFair()

bool monopoly::ai::decision::makeTradeFair ( const rules::GameState &  state,
rules::PlayerNumber  player,
std::span< const rules::PlayerNumber >  partners,
std::int64_t  giveMost,
bool  givingMonopoly,
ai::trade::TradeProposalList &  proposals,
const FairTradeConfig &  config,
std::span< const ai::trade::FutureImmunityRecord >  immunities 
)
noexcept

Definition at line 1756 of file AIDecisionUtility.cpp.

◆ mortgageNegativeCashPlayers()

void monopoly::ai::decision::mortgageNegativeCashPlayers ( rules::GameState &  state)
noexcept

Definition at line 1290 of file AIDecisionUtility.cpp.

◆ mortgageWorstProperty()

bool monopoly::ai::decision::mortgageWorstProperty ( rules::GameState &  state,
rules::PlayerNumber  player,
bool  sellHouses,
bool  mortgageMonopoly 
)
noexcept

Definition at line 1115 of file AIDecisionUtility.cpp.

◆ planBuyHouseAction()

EconomicActionPlan monopoly::ai::decision::planBuyHouseAction ( const rules::GameState &  state,
rules::PlayerNumber  player,
CashStrategy  strategy,
std::int64_t  minCashOnHand,
std::uint8_t  housingPurchaseStrategy,
std::int64_t  moneyOwed 
)
noexcept

Definition at line 570 of file AIDecisionUtility.cpp.

◆ planDebtLiquidationStep()

EconomicActionPlan monopoly::ai::decision::planDebtLiquidationStep ( const rules::GameState &  state,
rules::PlayerNumber  player,
bool  sellHouses 
)
noexcept

Definition at line 1248 of file AIDecisionUtility.cpp.

◆ planHouseSaleAction()

EconomicActionPlan monopoly::ai::decision::planHouseSaleAction ( const rules::GameState &  state,
rules::board::SquareType  referenceSquare 
)
noexcept

Definition at line 1211 of file AIDecisionUtility.cpp.

◆ planUnmortgagePropertyAction()

EconomicActionPlan monopoly::ai::decision::planUnmortgagePropertyAction ( const rules::GameState &  state,
rules::PlayerNumber  player,
CashStrategy  strategy,
std::int64_t  minCashOnHand,
std::int64_t  moneyOwed 
)
noexcept

Definition at line 914 of file AIDecisionUtility.cpp.

◆ shouldBuyHouse()

HousePurchaseDecision monopoly::ai::decision::shouldBuyHouse ( const rules::GameState &  state,
rules::PlayerNumber  player,
CashStrategy  strategy,
std::int64_t  minCashOnHand,
std::uint8_t  housingPurchaseStrategy,
std::int64_t  moneyOwed 
)
noexcept

Definition at line 498 of file AIDecisionUtility.cpp.

◆ shouldBuyProperty()

bool monopoly::ai::decision::shouldBuyProperty ( const rules::GameState &  state,
rules::PlayerNumber  player,
rules::board::SquareType  property,
CashStrategy  strategy,
std::int64_t  minCashOnHand,
std::span< const std::int64_t >  moneyOwed 
)
noexcept

Definition at line 141 of file AIDecisionUtility.cpp.

◆ shouldGiveAwayMonopoly()

bool monopoly::ai::decision::shouldGiveAwayMonopoly ( const rules::GameState &  state,
rules::PlayerNumber  player,
CashStrategy  strategy,
std::int64_t  minCashOnHand,
int  maxHousesPerSquareForGiveAway,
std::span< const std::int64_t >  moneyOwed 
)
noexcept

Definition at line 2570 of file AIDecisionUtility.cpp.

◆ shouldUnmortgageProperty()

bool monopoly::ai::decision::shouldUnmortgageProperty ( const rules::GameState &  state,
rules::PlayerNumber  player,
CashStrategy  strategy,
std::int64_t  minCashOnHand,
std::int64_t  moneyOwed 
)
noexcept

Definition at line 454 of file AIDecisionUtility.cpp.

◆ totalWorthWithFactors()

std::int64_t monopoly::ai::decision::totalWorthWithFactors ( const rules::GameState &  state,
rules::PlayerNumber  player,
const WorthFactors &  factors 
)
noexcept

Definition at line 1062 of file AIDecisionUtility.cpp.

◆ tradeBidForProperty()

std::int64_t monopoly::ai::decision::tradeBidForProperty ( const rules::GameState &  state,
rules::PlayerNumber  player,
rules::board::SquareType  property,
std::int64_t  currentBid,
rules::PlayerNumber  currentBidder,
const AuctionBidConfig &  config 
)
noexcept

Definition at line 1489 of file AIDecisionUtility.cpp.

Variable Documentation

◆ CriticalHousingLevel

constexpr std::uint8_t monopoly::ai::decision::CriticalHousingLevel = 3
inlineconstexpr

Definition at line 54 of file AIDecisionUtility.hpp.

◆ HouseBuyAtLeast3

constexpr std::uint8_t monopoly::ai::decision::HouseBuyAtLeast3 = 1u << 0
inlineconstexpr

Definition at line 85 of file AIDecisionUtility.hpp.

◆ HouseBuyWithin12

constexpr std::uint8_t monopoly::ai::decision::HouseBuyWithin12 = 1u << 1
inlineconstexpr

Definition at line 86 of file AIDecisionUtility.hpp.

◆ MonopolyAverageLandingFrequency

constexpr std::array<double, 8> monopoly::ai::decision::MonopolyAverageLandingFrequency
inlineconstexpr
Initial value:
{
0.785, 0.883, 0.957, 1.103, 1.093, 1.003, 0.957, 0.890}

Definition at line 23 of file AIDecisionUtility.hpp.