Give the six play settings of the tactics board an effect; draw the board in chalk

- Match engine (Modern turn driver only, MatchEngine::tactic_effects): wing play,
  through balls, goal kicks, flat or high balls, offside trap and pressing of a human
  side shift how often it and its opponent come to a chance (play_shift, at most two
  steps of the chance roll). Each setting pays in one situation and costs in another;
  pressing also raises the foul roll. No random numbers are drawn; computer sides and
  the Classic core are unchanged. Documented in docs/DIFFERENCES.md.
- The tactics read names the settings; desk and live dialog show every value in words
  with one sentence on its effect. The live dialog offers all eight settings again.
- The tactics board is a slate with a wooden frame, drawn in wobbling chalk strokes.
- modern_season_sim: SIM_TACTICS keeps a tactic set for measuring; new
  modern_play_shift_tests pin the direction of every setting.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Fable 5.2 committed 2026-11-14 14:49:19 +01:00
1 parent 9708b720b2
commit 919342a5ae
16 files changed
+344 -80

No files matched your search

+3 -13
View File
@@ -8,14 +8,7 @@ std::string live_score_text(const Json &score) {
}
// 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);
}
std::string live_tactic_value(size_t index, int value, int maximum) { return tactic_value_text(index, value, maximum); }
const Json &live_match_by_id(const Json &rows, const Json &id) {
for (const auto &row : rows) if (row.at("id") == id) return row;
@@ -112,13 +105,9 @@ std::string App::live_detail(const Json &owner, const Json &frame) {
}
if (live_tab_ == "tactics" && live_.running() && engine_live_tactics_.size() == 8) {
std::string out = "<div class=\"live-context\"><h3>" + live_text("Taktik in diesem Spiel") + "</h3>";
// the match engine reads the attitude (item 0) and the commitment (item 7); the play
// patterns between them have no effect on a match and are not offered here
for (size_t i = 0; i < engine_live_tactics_.size(); ++i)
if (i == 0 || i == 7)
out += "<div class=\"live-tactic-row\">" + live_text(engine_live_tactics_[i].at("label").get<std::string>()) +
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>";
out += "<p class=\"live-note\">" + live_text("Offensiver heißt mehr eigene Chancen und mehr Chancen für den Gegner. Mehr Einsatz bringt Druck nach vorn, aber auch mehr Karten und Verletzungen.") + "</p>";
return out + btn("live-intervene-tactics", "Taktik ändern", "", "id=\"live-tactics-edit\"") + "</div>";
}
if (live_tab_ == "tactics" && recorded)
@@ -181,9 +170,10 @@ 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)
if (!engine_board || i == 0 || i == 7)
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>";
}
if (live_dialog_ == "tactics" && live_.running() && engine_live_tactics_.size() == 8)
body += "<p id=\"live-tactic-effect\">" + live_text(tactic_effect_text(size_t(std::clamp(last_tactic_, 0, 7)))) + "</p>";
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>";
return "<div class=\"live-dialog-layer\"><div id=\"live-dialog\" class=\"live-dialog\" role=\"dialog\" aria-modal=\"true\" aria-labelledby=\"live-dialog-heading\">" + body + "</div></div>";