diff --git a/day03/part1.js b/day03/part1.js new file mode 100644 index 0000000..a705fe0 --- /dev/null +++ b/day03/part1.js @@ -0,0 +1,13 @@ +function getPos(num){ + var bottomCorner = Math.ceil(Math.sqrt(num)); + if(bottomCorner%2 == 0){ + bottomCorner++; + } + var sidelength = bottomCorner - 1; + var timesRound = (Math.pow(bottomCorner, 2) - num) / (bottomCorner - 1); + var lastsection = timesRound % 1; + var centerdistance = (Math.abs(0.5 - lastsection)) * sidelength; + console.log((sidelength / 2) + centerdistance); +} + +getPos(325489); diff --git a/day03/part1.txt b/day03/part1.txt deleted file mode 100644 index 3fd6de9..0000000 --- a/day03/part1.txt +++ /dev/null @@ -1 +0,0 @@ -I just calculated it manually, I'll probably write some code for it sometime