Monopoly — Portage moderne 0.1.0
Portage moderne C/C++23 du Monopoly de 1999
Loading...
Searching...
No Matches
AIProfile.hpp
Go to the documentation of this file.
1#pragma once
2
4
5#include <array>
6#include <cstdint>
7#include <expected>
8#include <filesystem>
9#include <string>
10#include <string_view>
11
13{
14 enum class ErrorCode : std::uint8_t
15 {
16 InvalidLevel = 0,
17 IoError,
21 };
22
23 struct Error
24 {
26 std::size_t line{};
27 std::string detail{};
28 };
29
30 struct Profile
31 {
32 std::array<double, rules::MaxPlayers> playerAttitude{};
37 std::int64_t timeForgetTrade{};
38 std::size_t maxTrades{};
41 std::int64_t minCashOnHand{};
44
50 double chancesFactor{};
52 double cashFactor{};
59
67 std::uint64_t patience{};
75 };
76
77 inline constexpr std::size_t TokenProfileCount = 11;
78 using ProfileSet = std::array<Profile, rules::MaxPlayers>;
79
81 {
82 std::array<std::int64_t, rules::MaxPlayers> moneyOwed{};
83 std::array<bool, rules::MaxPlayers> localAIPlayer{};
86 };
87
88 [[nodiscard]] std::expected<Profile, Error> parse(
89 std::string_view text,
90 int level);
91 [[nodiscard]] std::expected<Profile, Error> load(
92 const std::filesystem::path& path,
93 int level);
94 [[nodiscard]] std::string_view tokenFileName(std::uint8_t token) noexcept;
95
97 const ProfileSet& profiles,
99 const ConfigContext& context = {}) noexcept;
101 const ProfileSet& profiles,
103 const ConfigContext& context = {}) noexcept;
104 [[nodiscard]] decision::CounterProposalBalanceConfig makeCounterBalanceConfig(
105 const ProfileSet& profiles,
107 const ConfigContext& context = {}) noexcept;
108 [[nodiscard]] decision::MonopolyProposalConfig makeMonopolyProposalConfig(
109 const ProfileSet& profiles,
111 const ConfigContext& context = {}) noexcept;
112}
std::string_view text
unsigned index
int token
std::string path
std::expected< Profile, Error > load(const std::filesystem::path &path, int level)
std::array< Profile, rules::MaxPlayers > ProfileSet
Definition AIProfile.hpp:78
decision::CounterProposalBalanceConfig makeCounterBalanceConfig(const ProfileSet &profiles, rules::PlayerNumber strategyPlayer, const ConfigContext &context) noexcept
decision::MonopolyProposalConfig makeMonopolyProposalConfig(const ProfileSet &profiles, rules::PlayerNumber strategyPlayer, const ConfigContext &context) noexcept
decision::TradeEvaluationConfig makeTradeEvaluationConfig(const ProfileSet &profiles, rules::PlayerNumber strategyPlayer, const ConfigContext &context) noexcept
std::string_view tokenFileName(std::uint8_t token) noexcept
std::expected< Profile, Error > parse(std::string_view text, int level)
decision::CounterProposalPreflightConfig makeCounterPreflightConfig(const ProfileSet &profiles, rules::PlayerNumber strategyPlayer, const ConfigContext &context) noexcept
constexpr std::size_t TokenProfileCount
Definition AIProfile.hpp:77
std::array< MonopolyTradeGenerosity, WhatToTradeEntries > WhatToTradeTable
std::uint8_t PlayerNumber
Definition RuleTypes.hpp:12
constexpr PlayerNumber NobodyPlayer
Definition RuleTypes.hpp:16
rules::board::SquareType purchasingProperty
Definition AIProfile.hpp:85
rules::PlayerNumber purchasingPlayer
Definition AIProfile.hpp:84
std::array< bool, rules::MaxPlayers > localAIPlayer
Definition AIProfile.hpp:83
std::array< std::int64_t, rules::MaxPlayers > moneyOwed
Definition AIProfile.hpp:82
decision::CashStrategy cashStrategy
Definition AIProfile.hpp:42
decision::WorthFactors worthFactors
Definition AIProfile.hpp:53
std::array< double, rules::MaxPlayers > playerAttitude
Definition AIProfile.hpp:32
trade::WhatToTradeTable whatToTrade
Definition AIProfile.hpp:74
trade::PropertyImportanceConfig propertyImportance
Definition AIProfile.hpp:57