Skip to content

Commit 28c4e2e

Browse files
committed
adjust line wraps
1 parent 8425b12 commit 28c4e2e

File tree

5 files changed

+13
-7
lines changed

5 files changed

+13
-7
lines changed

2022/Day05/Solution.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ string MoveCrates(string input, Action<Move> crateMover) {
3434
// process each line by 4 character wide columns
3535
// last line defines the number of stacks:
3636
var stacks = stackDefs.Last().Chunk(4).Select(i => new Stack<char>()).ToArray();
37-
// bottom-up: push the next element to the the correspoing stack (' ' means no more elements).
37+
// bottom-up: push the next element to the the correspoing stack;
38+
// ' ' means no more elements.
3839
foreach (var line in stackDefs.Reverse().Skip(1)) {
3940
foreach (var (stack, item) in stacks.Zip(line.Chunk(4))) {
4041
// item is ~ "[A] "

2022/Day06/Solution.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ class Solution : Solver {
99
public object PartOne(string input) => StartOfBlock(input, 4);
1010
public object PartTwo(string input) => StartOfBlock(input, 14);
1111
int StartOfBlock(string input, int l) =>
12-
Enumerable.Range(l, input.Length).First(i => input.Substring(i-l, l).ToHashSet().Count == l);
12+
Enumerable.Range(l, input.Length)
13+
.First(i => input.Substring(i-l, l).ToHashSet().Count == l);
1314
}

2022/Day08/Solution.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ from icol in Enumerable.Range(0, ccol)
4646
select new Tree(items[irow][icol], irow, icol);
4747

4848
public int ViewDistance(Tree tree, Direction dir) =>
49-
IsTallest(tree, dir) ? TreesInDirection(tree, dir).Count() : SmallerTrees(tree, dir).Count() + 1;
49+
IsTallest(tree, dir) ? TreesInDirection(tree, dir).Count()
50+
: SmallerTrees(tree, dir).Count() + 1;
5051

5152
public bool IsTallest(Tree tree, Direction dir) =>
5253
TreesInDirection(tree, dir).All(treeT => treeT.height < tree.height);

2022/Day15/Solution.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public object PartTwo(string input) {
3636
// Parse the 4 numbers with regex from each line and return the list of pairings
3737
IEnumerable<Pair> Parse(string input) {
3838
foreach (var line in input.Split("\n")) {
39-
var numbers = Regex.Matches(line, "-?[0-9]+").Select(m => int.Parse(m.Value)).ToArray();
39+
var numbers = Regex.Matches(line, @"-?\d+").Select(m => int.Parse(m.Value)).ToArray();
4040
yield return new Pair(
4141
sensor: new Pos(numbers[0], numbers[1]),
4242
beacon: new Pos(numbers[2], numbers[3])

2022/Day16/Solution.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ int remainingTime
8080
valves.Remove(valve);
8181
remainingTime -= distance + 1;
8282

83-
flowFromRest = Math.Max(flowFromRest, MaxFlow(cache, map, valve, valves, remainingTime));
83+
flowFromRest = Math.Max(
84+
flowFromRest, MaxFlow(cache, map, valve, valves, remainingTime));
8485

8586
remainingTime += distance + 1;
8687
valves.Add(valve);
@@ -99,7 +100,7 @@ Map Parse(string input) {
99100
foreach (var line in input.Split("\n")) {
100101
var name = Regex.Match(line, "Valve (.*) has").Groups[1].Value;
101102
var flow = int.Parse(Regex.Match(line, @"\d+").Groups[0].Value);
102-
var tunnels = Regex.Match(line, "to valves? (.*)").Groups[1].Value.Split(", ").ToArray();
103+
var tunnels = Regex.Match(line, "to valves? (.*)").Groups[1].Value.Split(", ");
103104
valveList.Add(new Valve(0, name, flow, tunnels));
104105
}
105106
var valves = valveList
@@ -134,7 +135,9 @@ Map Parse(string input) {
134135
for (var target = 0; target < n; target++) {
135136
if (source != target) {
136137
for (var through = 0; through < n; through++) {
137-
if (distances[source, through] == int.MaxValue || distances[through, target] == int.MaxValue) {
138+
if (distances[source, through] == int.MaxValue ||
139+
distances[through, target] == int.MaxValue
140+
) {
138141
continue;
139142
}
140143
var cost = distances[source, through] + distances[through, target];

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy