mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-22 15:16:33 -08:00
Refactoring.
This commit is contained in:
@@ -251,8 +251,12 @@ public class Pattern
|
|||||||
{
|
{
|
||||||
Height = patternLines.Count;
|
Height = patternLines.Count;
|
||||||
Width = patternLines.Max(x => x.Length);
|
Width = patternLines.Max(x => x.Length);
|
||||||
|
Content = NormalizeWidth(patternLines);
|
||||||
Content = patternLines
|
}
|
||||||
|
|
||||||
|
private string[] NormalizeWidth(IReadOnlyCollection<string> patternLines)
|
||||||
|
{
|
||||||
|
return patternLines
|
||||||
.Select(x => x.PadRight(Width, ' '))
|
.Select(x => x.PadRight(Width, ' '))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user