cleanup day 3
This commit is contained in:
parent
13b2e3f72e
commit
a007a5a19d
|
@ -26,15 +26,6 @@ function toSubComponents(l: string) {
|
||||||
|
|
||||||
type Component = [number, number, string];
|
type Component = [number, number, string];
|
||||||
|
|
||||||
function isPartNumber(
|
|
||||||
components: Component[],
|
|
||||||
component: Component,
|
|
||||||
) {
|
|
||||||
return Boolean(
|
|
||||||
components.find((c) => isAdjacent(component, c) && c[2] !== "."),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether two components are adjacent
|
* Checks whether two components are adjacent
|
||||||
* @param c1 First component.
|
* @param c1 First component.
|
||||||
|
@ -51,6 +42,15 @@ function isAdjacent([y1, x1, s1]: Component, [y2, x2, s2]: Component) {
|
||||||
) || (y1 === y2) && (x2e === x1 - 1 || x2 === x1e + 1);
|
) || (y1 === y2) && (x2e === x1 - 1 || x2 === x1e + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isPartNumber(
|
||||||
|
components: Component[],
|
||||||
|
component: Component,
|
||||||
|
) {
|
||||||
|
return Boolean(
|
||||||
|
components.find((c) => isAdjacent(component, c) && c[2] !== "."),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function gearRatio(
|
function gearRatio(
|
||||||
components: Component[],
|
components: Component[],
|
||||||
component: Component,
|
component: Component,
|
||||||
|
|
Loading…
Reference in New Issue