Skip to content

Commit

Permalink
Merge commit '17ee781ead47b03940a417762611f15dc568a8fe' into feat/202…
Browse files Browse the repository at this point in the history
…0-day-09
  • Loading branch information
amclin committed Dec 18, 2020
2 parents 45c288b + 17ee781 commit c31cf28
Show file tree
Hide file tree
Showing 8 changed files with 610 additions and 377 deletions.
6 changes: 3 additions & 3 deletions 2018/day-03/claims.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const unique = require('../helpers').unique

var _conflicts = []
var _claims = []
var _cloth = []
let _conflicts = []
let _claims = []
let _cloth = []

/**
* Generates an empty matrix of X columns and Y rows
Expand Down
2 changes: 1 addition & 1 deletion 2018/day-03/claims.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-env mocha */
const expect = require('chai').expect
var {
const {
_cloth,
countConflicts,
findNonOverlappingClaims,
Expand Down
2 changes: 1 addition & 1 deletion 2018/day-10/beacons.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Beacon {
const data = {}
// Calculate the position of all the beacons
data.contents = this.start.map((beacon) => {
var point = {}
const point = {}
Object.keys(beacon.position).forEach((key) => {
point[key] = beacon.position[key] + (frame * beacon.velocity[key])
})
Expand Down
12 changes: 7 additions & 5 deletions 2018/day-10/solution.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ const init = (data) => {

// Find the frame with the best focus
const best = beaconTracker.frameMeta.reduce((acc, curr, idx) => {
return (curr.focus < acc.focus) ? {
idx: idx,
focus: curr.focus,
dims: curr.dims
} : acc
return (curr.focus < acc.focus)
? {
idx: idx,
focus: curr.focus,
dims: curr.dims
}
: acc
}, { idx: 0, focus: beaconTracker.frameMeta[0].focus, dims: { dim: [0, 0], origin: [0, 0] } })

// const answer = sumMetadata(data)
Expand Down
3 changes: 0 additions & 3 deletions 2018/day-11/fuel-cells.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ class Rack {
return null // break for speed on invalid squares
}
const dest = this.cells[pointer]
if (!dest) {

}
power += (dest) ? dest.power : 0
}
}
Expand Down
4 changes: 3 additions & 1 deletion 2018/day-13/tracks.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ class Track {
(this.trackTurns.indexOf(s) === 0 && a === 'x') // horizontal turns clockwise
// (this.trackTurns.indexOf(s) === 0 && a === 'x') // horizontal turns counter-clockwise
// (this.trackTurns.indexOf(s) === 1 && a === 'y') // vertical turns counter-clockwise
) ? 1 : -1
)
? 1
: -1
// Find the value of the new direction
return this.cartDirections[this._roationDirection(d, r)]
}
Expand Down
Loading

0 comments on commit c31cf28

Please sign in to comment.