From 6749aa37d55cc8c5cc7abc407e802a938f10bb71 Mon Sep 17 00:00:00 2001 From: Christopher Satchell Date: Sun, 23 Apr 2023 12:41:59 +0200 Subject: [PATCH] Improve some response syntax --- Game/Modules/Memory.cs | 2 +- Game/Modules/Simon.cs | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Game/Modules/Memory.cs b/Game/Modules/Memory.cs index d941a69..32da3d2 100644 --- a/Game/Modules/Memory.cs +++ b/Game/Modules/Memory.cs @@ -147,7 +147,7 @@ public override string Process(string command, Bomb bomb) } this.stage++; - return $"Press {numberToPress}, " + (this.stage != 6 ? $"stage {this.stage}" : "done"); + return $"Press {numberToPress}, {(this.stage != 6 ? $"stage {this.stage}" : "done")}."; } } } \ No newline at end of file diff --git a/Game/Modules/Simon.cs b/Game/Modules/Simon.cs index ae93899..e91af55 100644 --- a/Game/Modules/Simon.cs +++ b/Game/Modules/Simon.cs @@ -1,6 +1,7 @@ namespace KTANE.Game.Modules { using System.Collections.Generic; + using System.Linq; using System.Speech.Recognition; using System.Text; using KTANE.Game; @@ -84,17 +85,11 @@ public override string Process(string command, Bomb bomb) { this.sequence.Add(command); - StringBuilder buttonsToPress = new (); Dictionary targetDict = bomb.HasVowel.Value ? this.vowel[bomb.Strikes] : this.noVowel[bomb.Strikes]; - foreach (string s in this.sequence) - { - _ = buttonsToPress.Append($"{targetDict[s]}, "); - } - - return $"Press {buttonsToPress}."; + return $"Press {string.Join(", ", this.sequence.Select(s => targetDict[s]))}."; } } } \ No newline at end of file