Start Modern managers with the assistant's attitude control; name live tactic values
A new Modern manager's assistant adapts the attitude to the score, as the computer clubs do, until the manager sets it himself; an idle human club no longer plays whole matches at the most defensive attitude (12-season simulation: 1.40 instead of 1.12 goals per match, league average 1.44). The live tactics board shows values in words, and refused live commands are written to stderr. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
6970dfa20a
commit
f2dcf94d2b
5 files changed
+28
-2
No files matched your search
@@ -6,7 +6,18 @@ std::string live_text(const std::string &value, const std::string &css = {}) {
|
||||
std::string live_score_text(const Json &score) {
|
||||
return std::to_string(score[0].get<int>()) + " : " + std::to_string(score[1].get<int>());
|
||||
}
|
||||
// A value of the engine's tactics board in words: the attitude (item 0, lowest = most
|
||||
// defensive), the commitment (item 7) and the numbered variants of the play patterns.
|
||||
std::string live_tactic_value(size_t index, int value, int maximum) {
|
||||
if (index == 0 && maximum == 3) {
|
||||
static const std::array<const char *, 4> attitude{"Sehr defensiv", "Defensiv", "Offensiv", "Sehr offensiv"};
|
||||
if (value >= 0 && value <= 3) return attitude[size_t(value)];
|
||||
}
|
||||
if (index == 7) return std::to_string(value) + " von " + std::to_string(maximum);
|
||||
return "Variante " + std::to_string(value + 1) + " von " + std::to_string(maximum + 1);
|
||||
}
|
||||
const Json &live_match_by_id(const Json &rows, const Json &id) {
|
||||
|
||||
for (const auto &row : rows) if (row.at("id") == id) return row;
|
||||
throw editor::Error("live_match_unavailable");
|
||||
}
|
||||
@@ -103,7 +114,7 @@ std::string App::live_detail(const Json &owner, const Json &frame) {
|
||||
std::string out = "<div class=\"live-context\"><h3>" + live_text("Taktik in diesem Spiel") + "</h3>";
|
||||
for (size_t i = 0; i < engine_live_tactics_.size(); ++i)
|
||||
out += "<div class=\"live-tactic-row\">" + live_text(engine_live_tactics_[i].at("label").get<std::string>()) +
|
||||
live_text("Wert " + std::to_string(engine_live_tactics_[i].at("value").get<int>())) + "</div>";
|
||||
live_text(i == 0 && engine_live_assistant_ ? std::string("Assistent passt an") : live_tactic_value(i, engine_live_tactics_[i].at("value").get<int>(), engine_live_tactics_[i].at("max").get<int>())) + "</div>";
|
||||
return out + btn("live-intervene-tactics", "Taktik ändern", "", "id=\"live-tactics-edit\"") + "</div>";
|
||||
}
|
||||
if (live_tab_ == "tactics" && recorded)
|
||||
@@ -145,7 +156,7 @@ std::string App::live_dialog_markup(const Json &owner) {
|
||||
const bool engine_board = live_.running() && engine_live_tactics_.size() == 8;
|
||||
const auto &values = engine_board ? live_dialog_draft_.at("values") : live_dialog_draft_.at("tactics").at("values");
|
||||
for (size_t i = 0; i < names.size(); ++i)
|
||||
body += "<div class=\"live-tactic-row\">" + live_text(engine_board ? engine_live_tactics_[i].at("label").get<std::string>() : std::string(names[i])) + btn("live-tactic-cycle", "Wert " + std::to_string(values[i].get<int>()), "", "id=\"live-tactic-" + std::to_string(i) + "\" data-id=\"" + std::to_string(i) + "\"") + "</div>";
|
||||
body += "<div class=\"live-tactic-row\">" + live_text(engine_board ? engine_live_tactics_[i].at("label").get<std::string>() : std::string(names[i])) + btn("live-tactic-cycle", engine_board ? live_tactic_value(i, values[i].get<int>(), engine_live_tactics_[i].at("max").get<int>()) : "Wert " + std::to_string(values[i].get<int>()), "", "id=\"live-tactic-" + std::to_string(i) + "\" data-id=\"" + std::to_string(i) + "\"") + "</div>";
|
||||
}
|
||||
body += "<div class=\"live-dialog-actions\">" + btn("live-dialog-cancel", "Abbrechen", "", "id=\"live-dialog-cancel\"") +
|
||||
btn("live-dialog-apply", live_.running() ? (live_dialog_ == "lineup" ? "Wechsel ausführen" : "Taktik übernehmen") : "Demovorschau anzeigen", "", "id=\"live-dialog-apply\" " + std::string(live_dialog_ == "lineup" && (live_out_.empty() || live_in_.empty()) ? "disabled" : "")) + "</div>";
|
||||
|
||||
Reference in new issue
Block a user