A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
ui: the money sign sits next to the number, not the currency (refs #1107) (#1171)
agamrafaeli-instinct14b1407a7b74
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 379017cac..51486e959 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -49,6 +49,7 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIBzoom. A new `ZoomKeys` action in the Camera map; the wheel's `Zoom` keeps its one binding.### Fixed+- Money negatives and changes put the sign next to the number, not the currency ("IL -3.0m", "IL +1.2m"), everywhere the player sees money - top bar, Budget, Why?, the turn report and tooltips - in English and Hebrew (player feedback, 19 October 2026, refs #1107).- Fractional site and city-project carry is hashed as IEEE bits on every runtime, avoiding different decimal spellings on .NET and Unity Mono; gameplay progress is unchanged.- Site construction forecasts use the current minister rate and saved fractional work, including pioneer promotion.- On a notched phone the HUD and the panels keep clear of the notch and the home indicator: the root is padded bydiff --git a/docs/m3-rulings.md b/docs/m3-rulings.mdindex a77e47ccc..afc253d35 100644--- a/docs/m3-rulings.md+++ b/docs/m3-rulings.md@@ -62,7 +62,7 @@ These are the decisions made while building M3 where the spec or plan was silent- There is no silent id fallback.- **One formatting rule each for dates, money and scale.**- Dates read "15 May 1948" through one formatter.- - Money carries a unit (IL or $) from the content money list, with one sign style ("-IL 3.0m") for values and changes.+ - Money carries a unit (IL or $) from the content money list, with one sign style for values and changes. The style was "-IL 3.0m"; since 19 October 2026 (player feedback, #1107) the sign sits next to the number: "IL -3.0m".- Indicators use one 0–100 display scale through one helper.- Vacant offices read "(vacant)".- Cause lines are sentence-case.diff --git a/sim/Statecraft.Sim.Tests/PlayerTextTests.cs b/sim/Statecraft.Sim.Tests/PlayerTextTests.csindex 9bb71a0bb..d9469eba2 100644--- a/sim/Statecraft.Sim.Tests/PlayerTextTests.cs+++ b/sim/Statecraft.Sim.Tests/PlayerTextTests.cs@@ -280,12 +280,12 @@ public class PlayerTextTestsforeach (var w in AllCauses(Real)){// Every number in the line must carry the unit (fix round 2, N3): strip the unit tokens; no digit may remain.- if (money.Contains(w.Target) && Regex.IsMatch(Regex.Replace(w.Message, @"[+-]?(IL |\$)\d+\.\dm", ""), @"\d"))+ if (money.Contains(w.Target) && Regex.IsMatch(Regex.Replace(w.Message, @"(IL |\$)[+-]?\d+\.\dm", ""), @"\d"))bad.Add("money without a unit: " + w.Message);if (w.System == "map") // "Built a housing project: cost IL 6.0m, Housing +3.0%, ...": every number with its unit{// A hex "(q, r)" and a corridor's "segment N" (R-COR-001, Q-SENS-1) are names, not amounts.- if (Regex.IsMatch(Regex.Replace(Regex.Replace(w.Message, @"\(-?\d+, -?\d+\)|segment \d+", ""), @"[+-]?(IL |\$)\d+\.\dm|[+-]?\d+(\.\d)?%", ""), @"\d"))+ if (Regex.IsMatch(Regex.Replace(Regex.Replace(w.Message, @"\(-?\d+, -?\d+\)|segment \d+", ""), @"(IL |\$)[+-]?\d+\.\dm|[+-]?\d+(\.\d)?%", ""), @"\d"))bad.Add("map line number without a unit: " + w.Message);}else if (indicators.Contains(w.Target) && Regex.IsMatch(Regex.Replace(w.Message, @"[+-]?\d+(\.\d)?%", ""), @"\d"))@@ -301,13 +301,13 @@ public class PlayerTextTests{Assert.Equal("IL 18.6m", PlayerText.Money(Real, "treasury", 18.6));Assert.Equal("$41.5m", PlayerText.Money(Real, "fx_reserves", 41.5));- Assert.Equal("+IL 1.2m", PlayerText.MoneyChange(Real, "treasury", 1.23));- Assert.Equal("-$0.4m", PlayerText.MoneyChange(Real, "fx_reserves", -0.4));+ Assert.Equal("IL +1.2m", PlayerText.MoneyChange(Real, "treasury", 1.23));+ Assert.Equal("$-0.4m", PlayerText.MoneyChange(Real, "fx_reserves", -0.4));Assert.Equal("$0.0m", PlayerText.MoneyChange(Real, "fx_reserves", -0.004));Assert.Equal(30.0, PlayerText.Scale(0.3), 9);Assert.Equal("55%", PlayerText.Percent(0.55));Assert.Equal("+4.1%", PlayerText.PercentChange(0.041));- Assert.Equal("Money -IL 2.0m", PlayerText.Change(Real, "treasury", -2)); // R-MONEY-001+ Assert.Equal("Money IL -2.0m", PlayerText.Change(Real, "treasury", -2)); // R-MONEY-001Assert.Equal("Social cohesion +5.0%", PlayerText.Change(Real, "morale", 0.05));Assert.Equal("Foreign currency", PlayerText.Target(Real, "fx_reserves"));}@@ -366,7 +366,7 @@ public class PlayerTextTests// ---- Fix round 2 (N2): one sign style, unsigned zero, no NaN ----[Fact]- public void ZeroIsUnsignedAndTheSignGoesBeforeTheCurrency()+ public void ZeroIsUnsignedAndTheSignSitsNextToTheNumber(){Assert.Equal("0%", PlayerText.Percent(-0.004));Assert.Equal("55%", PlayerText.Percent(0.55));@@ -377,15 +377,15 @@ public class PlayerTextTestsAssert.Equal("-4.0%", PlayerText.PercentChange(-0.04));Assert.Equal("+5%", PlayerText.PercentChange(0.05, 0));Assert.Equal("0%", PlayerText.PercentChange(-0.004, 0));- Assert.Equal("-IL 3.0m", PlayerText.Money(Real, "treasury", -3));+ Assert.Equal("IL -3.0m", PlayerText.Money(Real, "treasury", -3));Assert.Equal("IL 0.0m", PlayerText.Money(Real, "treasury", -0.04));// #398 review N2: the parts Money is built from, for the top bar's words ("IL 18.6 million").Assert.Equal(("-", "IL ", "3.0"), PlayerText.MoneyParts(Real, "treasury", -3));Assert.Equal(("", "IL ", "0.0"), PlayerText.MoneyParts(Real, "treasury", -0.04));Assert.Equal(("", "$", "41.5"), PlayerText.MoneyParts(Real, "fx_reserves", 41.46));Assert.Equal("$41.5m", PlayerText.Money(Real, "fx_reserves", 41.5));- Assert.Equal("+IL 1.2m", PlayerText.MoneyChange(Real, "treasury", 1.23));- Assert.Equal("-$0.4m", PlayerText.MoneyChange(Real, "fx_reserves", -0.4));+ Assert.Equal("IL +1.2m", PlayerText.MoneyChange(Real, "treasury", 1.23));+ Assert.Equal("$-0.4m", PlayerText.MoneyChange(Real, "fx_reserves", -0.4));Assert.Equal("$0.0m", PlayerText.MoneyChange(Real, "fx_reserves", -0.04));Assert.Equal("IL 0.0m", PlayerText.MoneyChange(Real, "treasury", 0.04));}diff --git a/sim/Statecraft.Sim.Tests/TreasuryFloorTests.cs b/sim/Statecraft.Sim.Tests/TreasuryFloorTests.csindex d8d256fbf..0d8d13257 100644--- a/sim/Statecraft.Sim.Tests/TreasuryFloorTests.cs+++ b/sim/Statecraft.Sim.Tests/TreasuryFloorTests.cs@@ -21,7 +21,7 @@ public class TreasuryFloorTestsAssert.True(s.Treasury >= 0, $"turn {s.Turn} ({s.Date:yyyy-MM-dd}): Treasury {s.Treasury}");if (firstDebt == null && s.Debt > 0) firstDebt = s.Turn;}- Assert.Equal(4, firstDebt); // 15 September 1948: the HUD's "-IL 1.5m" is 0 cash and IL 1.5m debt+ Assert.Equal(4, firstDebt); // 15 September 1948: the HUD's "IL -1.5m" is 0 cash and IL 1.5m debt}// R-MONEY-003: an event's cost is a payment like any other. With IL 0.4m in the Treasury, the IL 1m claim on Germany@@ -52,7 +52,7 @@ public class TreasuryFloorTestsvar why = new List<Cause>();Assert.Null(EventSystem.Choose(Real, s, "reparations_claim", "claim", why));var money = why.Where(x => x.Target == "treasury" || x.Target == "debt").Select(x => x.Message).ToList();- Assert.Equal(new[] { "Money -IL 1.0m (A Claim on Germany)", "Borrowed IL 0.6m for A Claim on Germany" }, money);+ Assert.Equal(new[] { "Money IL -1.0m (A Claim on Germany)", "Borrowed IL 0.6m for A Claim on Germany" }, money);}// R-MONEY-003: an event that brings money in adds it to the Treasury and borrows nothing, debt or no debt.diff --git a/sim/Statecraft.Sim/PlayerText.cs b/sim/Statecraft.Sim/PlayerText.csindex f1e0a69f4..d310678ec 100644--- a/sim/Statecraft.Sim/PlayerText.cs+++ b/sim/Statecraft.Sim/PlayerText.cs@@ -68,16 +68,17 @@ namespace Statecraft.Simstatic string Fixed(double abs, int decimals) => abs.ToString(decimals == 0 ? "0" : "0.0", CultureInfo.InvariantCulture);- /// <summary>The one sign style: the sign goes before the currency or number, and a value that rounds to zero prints- /// unsigned. <paramref name="signed"/> adds "+" to positive values (changes).</summary>+ /// <summary>The one sign style: the sign goes after the currency prefix, next to the number ("IL -3.0m";+ /// player feedback, 19 October 2026, #1107), and a value that rounds to zero prints unsigned.+ /// <paramref name="signed"/> adds "+" to positive values (changes).</summary>static string Signed(double rounded, string prefix, string body, bool signed) =>- rounded == 0 ? prefix + body : (rounded < 0 ? "-" : signed ? "+" : "") + prefix + body;+ rounded == 0 ? prefix + body : prefix + (rounded < 0 ? "-" : signed ? "+" : "") + body;- /// <summary>An amount in millions with its currency: "IL 18.6m", "-IL 3.0m", "$41.5m"; zero is "IL 0.0m".</summary>+ /// <summary>An amount in millions with its currency: "IL 18.6m", "IL -3.0m", "$41.5m"; zero is "IL 0.0m".</summary>public static string Money(Content c, string id, double millions){var (sign, prefix, amount) = MoneyParts(c, id, millions);- return sign + prefix + amount + "m";+ return prefix + sign + amount + "m";}/// <summary>The parts Money is built from, rounded as it rounds: the sign ("-", or "" for a value that rounds to zero@@ -88,7 +89,7 @@ namespace Statecraft.Simreturn (r < 0 ? "-" : "", Account(c, id).Prefix, Fixed(Math.Abs(r), 1));}- /// <summary>A change in millions with its currency, sign first: "+IL 1.2m", "-$0.4m"; zero is "IL 0.0m".</summary>+ /// <summary>A change in millions with its currency, sign next to the number: "IL +1.2m", "$-0.4m"; zero is "IL 0.0m".</summary>public static string MoneyChange(Content c, string id, double millions){var r = Math.Round(Finite(millions, nameof(millions)), 1, MidpointRounding.AwayFromZero);@@ -128,7 +129,7 @@ namespace Statecraft.Simreturn Signed(r, "", Fixed(Math.Abs(r), 0) + " units", signed: true);}- /// <summary>"Morale +4.1%" or "Treasury -IL 2.0m": the name and the change, in the target's unit.</summary>+ /// <summary>"Morale +4.1%" or "Treasury IL -2.0m": the name and the change, in the target's unit.</summary>public static string Change(Content c, string id, double change) =>(id == Pools.FoodTarget ? "Food" : id == Pools.ArmsTarget ? "Arms" : Target(c, id)) + " "+ (id == Pools.FoodTarget || id == Pools.ArmsTarget ? UnitsChange(change) : IsMoney(c, id) ? MoneyChange(c, id, change) : PercentChange(change));diff --git a/unity/Assets/Scripts/UI/HudModel.cs b/unity/Assets/Scripts/UI/HudModel.csindex 1778b64dc..c929e8fb1 100644--- a/unity/Assets/Scripts/UI/HudModel.cs+++ b/unity/Assets/Scripts/UI/HudModel.cs@@ -89,7 +89,7 @@ namespace Statecraft.Game.UIstring Millions(string id, double millions){var (sign, prefix, amount) = PlayerText.MoneyParts(c, id, millions);- return t.Format("hud.say_million", sign + prefix, amount);+ return t.Format("hud.say_million", prefix + sign, amount);}Meter Money(string id, double now, double? before){diff --git a/unity/Assets/Tests/EditMode/HebrewValuesTests.cs b/unity/Assets/Tests/EditMode/HebrewValuesTests.csindex 3b7ef3978..9b869f2c6 100644--- a/unity/Assets/Tests/EditMode/HebrewValuesTests.cs+++ b/unity/Assets/Tests/EditMode/HebrewValuesTests.cs@@ -31,8 +31,8 @@ public class HebrewValuesTests[Test]public void AValueInAHebrewTemplateIsWrappedInLeftToRightMarks(){- Assert.AreEqual("כסף " + Lrm + "$12.0m" + Lrm + " · חוב " + Lrm + "IL 3.0m" + Lrm + " · מטבע חוץ " + Lrm + "-$4.2m" + Lrm,- He.Format("budget.money", "$12.0m", "IL 3.0m", "-$4.2m"));+ Assert.AreEqual("כסף " + Lrm + "$12.0m" + Lrm + " · חוב " + Lrm + "IL 3.0m" + Lrm + " · מטבע חוץ " + Lrm + "$-4.2m" + Lrm,+ He.Format("budget.money", "$12.0m", "IL 3.0m", "$-4.2m"));Assert.AreEqual("מ־" + Lrm + "15 May 1948" + Lrm + " עד " + Lrm + "1 June 1948" + Lrm, He.Format("why.turn", "15 May 1948", "1 June 1948"));// A format item keeps its format: the value is formatted, then wrapped.Assert.AreEqual("תשומת לב " + Lrm + "2.5" + Lrm + " מתוך " + Lrm + "10.0" + Lrm, He.Format("hud.attention", 2.5, 10.0));@@ -55,8 +55,8 @@ public class HebrewValuesTestsvar appointed = He.Format("card.appointed_name", "דוד בן־גוריון");Assert.AreEqual("דוד בן־גוריון (מינוי שלך)", appointed);Assert.IsTrue(UiDirection.RightToLeft(appointed), appointed);- var amount = He.Format("hud.say_million", "-IL ", "3.0");- Assert.AreEqual(Lrm + "-IL " + Lrm + Lrm + "3.0" + Lrm + " מיליון", amount);+ var amount = He.Format("hud.say_million", "IL -", "3.0");+ Assert.AreEqual(Lrm + "IL -" + Lrm + Lrm + "3.0" + Lrm + " מיליון", amount);Assert.AreEqual("כסף: " + amount + ", קיטון של " + Lrm + "IL " + Lrm + Lrm + "4.0" + Lrm + " מיליון מאז התור הקודם",He.Format("hud.say_down", "כסף", amount, He.Format("hud.say_million", "IL ", "4.0")));}@@ -95,7 +95,7 @@ public class HebrewValuesTestsvar en = En;var keys = Keys(UiPaths.Strings);Assert.Greater(keys.Count, 100, "the keys are read");- var args = new object[] { "-$4.2m", "15 May 1948", 2.5, 46, "IL 3.0m", "Mapai", 7, 1948 };+ var args = new object[] { "$-4.2m", "15 May 1948", 2.5, 46, "IL 3.0m", "Mapai", 7, 1948 };foreach (var key in keys){string expected;@@ -105,7 +105,7 @@ public class HebrewValuesTestsCollectionAssert.AreEqual(Encoding.UTF8.GetBytes(expected), Encoding.UTF8.GetBytes(got), key);Assert.AreEqual(-1, got.IndexOf(Lrm, StringComparison.Ordinal), key);}- Assert.AreEqual("Money $12.0m · debt IL 3.0m · foreign currency -$4.2m", en.Format("budget.money", "$12.0m", "IL 3.0m", "-$4.2m"));+ Assert.AreEqual("Money $12.0m · debt IL 3.0m · foreign currency $-4.2m", en.Format("budget.money", "$12.0m", "IL 3.0m", "$-4.2m"));Assert.AreEqual("15 May 1948 to 1 June 1948", en.Format("why.turn", "15 May 1948", "1 June 1948"));}@@ -115,7 +115,7 @@ public class HebrewValuesTestspublic void TakingTheMarksOutOfAnyHebrewLineGivesTheOldTextBack(){var he = He;- var args = new object[] { "-$4.2m", "15 May 1948", 2.5, 46, "IL 3.0m", "Mapai", 7, 1948 };+ var args = new object[] { "$-4.2m", "15 May 1948", 2.5, 46, "IL 3.0m", "Mapai", 7, 1948 };int wrapped = 0;foreach (var key in Keys(UiPaths.StringsHebrew)){@@ -342,20 +342,21 @@ public class HebrewValuesTestsAssert.IsTrue(dateMarked, "marked, \"15 May 1948\" is drawn as one run, as it is on its own");}- /// <summary>The lines the game shows (#543's "done when"): Hebrew budget.money with negative foreign currency draws its- /// minus on the left of the dollar, and Hebrew why.turn draws "15 May 1948" as one run.</summary>+ /// <summary>The lines the game shows (#543's "done when"; sign style from #1107): Hebrew budget.money with negative+ /// foreign currency draws "$-4.2m" as one left-to-right run - the dollar leads, the minus sits next to the number -+ /// and Hebrew why.turn draws "15 May 1948" as one run.</summary>[UnityTest]- public IEnumerator InAHebrewLineTheMinusIsLeftOfItsDollarAndTheDateIsOneRun()+ public IEnumerator InAHebrewLineTheDollarLeadsItsMinusAndTheDateIsOneRun(){using var r = new Rendered(- He.Format("budget.money", "$12.0m", "IL 3.0m", "-$4.2m"),+ He.Format("budget.money", "$12.0m", "IL 3.0m", "$-4.2m"),He.Format("why.turn", "15 May 1948", "1 June 1948"),"15 May 1948");yield return r.Draw();Assert.AreEqual(LanguageDirection.RTL, r.Labels[0].languageDirection, r.Labels[0].text);Assert.AreEqual(LanguageDirection.RTL, r.Labels[1].languageDirection, r.Labels[1].text);- int minus = LeftmostInkHeight(r.Row(0));- Assert.Less(minus, FontSize / 5, $"the leftmost glyph of the line (its last value, '-$4.2m') is the minus ({minus}px tall), not the dollar");+ int dollar = LeftmostInkHeight(r.Row(0));+ Assert.Greater(dollar, FontSize / 5, $"the leftmost glyph of the line (its last value, '$-4.2m') is the dollar ({dollar}px tall); the minus sits next to the number");Assert.IsTrue(Found(r.Row(1), r.Row(2)), $"\"15 May 1948\" is drawn as one run, as it is on its own: its words {Show(Words(r.Row(2)))}, the line's {Show(Words(r.Row(1)))}");}}diff --git a/unity/Assets/Tests/EditMode/HudTests.cs b/unity/Assets/Tests/EditMode/HudTests.csindex 7dadea784..c0b017993 100644--- a/unity/Assets/Tests/EditMode/HudTests.cs+++ b/unity/Assets/Tests/EditMode/HudTests.cs@@ -87,7 +87,7 @@ public class HudTestsAssert.Greater(bridge.State.Debt, 0.0);var m = HudModel.From(bridge, Text);Assert.AreEqual(PlayerText.Money(C, "treasury", -bridge.State.Debt), m.Treasury.Value);- StringAssert.Contains("-IL", m.Treasury.Value);+ StringAssert.Contains("IL -", m.Treasury.Value);}/// <summary>#681 (owner, 16 October 2026: "keep one top-bar figure and label it as net (cash minus debt)"): the Money@@ -107,7 +107,7 @@ public class HudTestsAssert.AreEqual(caption, meter.Q<Label>(className: "meter-name").text);StringAssert.StartsWith(caption + ":", meter.tooltip);Assert.AreEqual(PlayerText.Money(C, "treasury", bridge.State.Treasury - bridge.State.Debt), ui.Q<Label>("treasury-value").text);- StringAssert.Contains("-IL", ui.Q<Label>("treasury-value").text);+ StringAssert.Contains("IL -", ui.Q<Label>("treasury-value").text);}// ---- The score (#380): only in the GDD loop, from GameState.Score ----@@ -367,7 +367,7 @@ public class HudTestsvar now = bridge.State;prev.Treasury = now.Treasury - now.Debt + prev.Debt - 5; // up by 5hud.Render();- Assert.AreEqual("+IL 5.0m", ui.Q<Label>("treasury-delta").text);+ Assert.AreEqual("IL +5.0m", ui.Q<Label>("treasury-delta").text);Assert.IsTrue(ui.Q<Label>("treasury-delta").ClassListContains("delta-up"));Assert.IsFalse(ui.Q<Label>("treasury-delta").ClassListContains("delta-down"));prev.Treasury = now.Treasury - now.Debt + prev.Debt + 0.04; // down by 0.04: rounds to zero, never "-0.0"@@ -569,9 +569,9 @@ public class HudTestsprev.Indicators["security"] = now.Indicators["security"] - 0.05; // up 5 pointsprev.Treasury = now.Treasury - now.Debt + prev.Debt + 3; // down by 3var m = HudModel.From(bridge, Text);- Assert.AreEqual("-$2.0m", m.Fx.Delta);+ Assert.AreEqual("$-2.0m", m.Fx.Delta);Assert.AreEqual("+5%", m.Security.Delta);- Assert.AreEqual("-IL 3.0m", m.Treasury.Delta);+ Assert.AreEqual("IL -3.0m", m.Treasury.Delta);}/// <summary>Fix round 2 (N4, N5): no script rescales a sim number for display itself: 0..1 values go through@@ -756,14 +756,14 @@ public class HudTestsnow.Debt = now.Treasury + 3; // net -3.0prev.Debt = prev.Treasury - 1; // net +1.0 before: down by 4m = HudModel.From(bridge, Text);- Assert.AreEqual("Money: -IL 3.0 million, down IL 4.0 million since last turn", HudModel.Spoken(Text, "Money", m.Treasury));+ Assert.AreEqual("Money: IL -3.0 million, down IL 4.0 million since last turn", HudModel.Spoken(Text, "Money", m.Treasury));using var ui = new UiTestKit();var he = He;new HudPresenter(ui.Root, bridge, he);var said = ui.Q<VisualElement>("meter-treasury").tooltip;- // The values carry left-to-right marks (U+200E, #543), so the minus stays on the left of "IL" in a right-to-left line.- Assert.AreEqual("כסף (נטו): \u200E-IL \u200E\u200E3.0\u200E מיליון, קיטון של \u200EIL \u200E\u200E4.0\u200E מיליון מאז התור הקודם", said);- Assert.AreEqual("כסף (נטו): -IL 3.0 מיליון, קיטון של IL 4.0 מיליון מאז התור הקודם", said.Replace("\u200E", ""));+ // The values carry left-to-right marks (U+200E, #543), so the value stays one left-to-right run - "IL -3.0" with the minus next to the number - in a right-to-left line.+ Assert.AreEqual("כסף (נטו): \u200EIL -\u200E\u200E3.0\u200E מיליון, קיטון של \u200EIL \u200E\u200E4.0\u200E מיליון מאז התור הקודם", said);+ Assert.AreEqual("כסף (נטו): IL -3.0 מיליון, קיטון של IL 4.0 מיליון מאז התור הקודם", said.Replace("\u200E", ""));foreach (var id in MeterIds){var tip = ui.Q<VisualElement>("meter-" + id).tooltip;