├── 2019 ├── day 1 │ ├── input.test.txt │ ├── bin.js │ ├── test.js │ ├── input.txt │ ├── index.js │ └── README.md └── day 2 │ ├── input.test.txt │ ├── input.txt │ ├── bin.js │ ├── test.js │ ├── index.js │ └── README.md ├── .gitignore ├── readme.md ├── .vscode └── launch.json ├── package.json └── license /2019/day 1/input.test.txt: -------------------------------------------------------------------------------- 1 | 12 2 | 14 3 | 1969 -------------------------------------------------------------------------------- /2019/day 2/input.test.txt: -------------------------------------------------------------------------------- 1 | 1,9,10,3,2,3,11,0,99,30,40,50 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | coverage/ 3 | npm-debug.log* 4 | .nyc_output 5 | *.log -------------------------------------------------------------------------------- /2019/day 2/input.txt: -------------------------------------------------------------------------------- 1 | 1,0,0,3,1,1,2,3,1,3,4,3,1,5,0,3,2,1,9,19,1,19,5,23,2,6,23,27,1,6,27,31,2,31,9,35,1,35,6,39,1,10,39,43,2,9,43,47,1,5,47,51,2,51,6,55,1,5,55,59,2,13,59,63,1,63,5,67,2,67,13,71,1,71,9,75,1,75,6,79,2,79,6,83,1,83,5,87,2,87,9,91,2,9,91,95,1,5,95,99,2,99,13,103,1,103,5,107,1,2,107,111,1,111,5,0,99,2,14,0,0 -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # adventofcode 2 | [![Build Status](https://img.shields.io/travis/YerkoPalma/adventofcode/master.svg?style=flat-square)](https://travis-ci.org/YerkoPalma/adventofcode) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard) 3 | 4 | > Nothing 5 | 6 | ## License 7 | [MIT](/license) 8 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Launch Program", 11 | "skipFiles": [ 12 | "/**" 13 | ], 14 | "program": "${workspaceFolder}\\index.js" 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /2019/day 1/bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const { calculateFromInput, calculateFromInputRecursive } = require('./') 4 | let path 5 | 6 | if (process.argv.length === 3) { 7 | path = process.argv[2] 8 | calculateFromInput(path, (err, fuel) => { 9 | if (err) console.error(err) 10 | console.log(fuel) 11 | }) 12 | } 13 | 14 | if (process.argv.length === 4 && process.argv[2] === '-r') { 15 | path = process.argv[3] 16 | calculateFromInputRecursive(path, (err, fuel) => { 17 | if (err) console.error(err) 18 | console.log(fuel) 19 | }) 20 | } 21 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "adventofcode", 3 | "description": "Nothing", 4 | "author": "YerkoPalma", 5 | "version": "0.1.0", 6 | "main": "index.js", 7 | "files": [ 8 | "index.js" 9 | ], 10 | "scripts": { 11 | "test": "standard --verbose | snazzy && tape 2019/*/test.js | tap-summary", 12 | "start": "node index.js" 13 | }, 14 | "repository": "YerkoPalma/adventofcode", 15 | "license": "MIT", 16 | "keywords": [ 17 | "advent", 18 | "of", 19 | "code" 20 | ], 21 | "devDependencies": { 22 | "snazzy": "^8.0.0", 23 | "standard": "^14.3.1", 24 | "tap-summary": "^4.0.0", 25 | "tape": "^4.11.0" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /2019/day 2/bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const { makeIntcodeFromFile, findInputsForTarget } = require('./') 4 | let path 5 | let target 6 | 7 | /** 8 | * replace position 1 with the value 12 and replace position 2 with the value 2 9 | */ 10 | if (process.argv.length === 3) { 11 | path = process.argv[2] 12 | makeIntcodeFromFile(path, { 1: 12, 2: 2 }, (err, intcode) => { 13 | if (err) console.error(err) 14 | console.log(intcode[0]) 15 | }) 16 | } 17 | 18 | if (process.argv.length === 4) { 19 | path = process.argv[2] 20 | target = parseInt(process.argv[3], 10) 21 | findInputsForTarget(path, target, (err, nounAndVerb) => { 22 | if (err) console.error(err) 23 | console.log(nounAndVerb) 24 | }) 25 | } 26 | -------------------------------------------------------------------------------- /2019/day 2/test.js: -------------------------------------------------------------------------------- 1 | const test = require('tape') 2 | const path = require('path') 3 | const { makeIntcode, makeIntcodeFromFile, findInputsForTarget } = require('./') 4 | 5 | test('makeIntcode', function (t) { 6 | t.plan(4) 7 | 8 | t.deepEqual(makeIntcode([1, 0, 0, 0, 99]), [2, 0, 0, 0, 99]) 9 | t.deepEqual(makeIntcode([2, 3, 0, 3, 99]), [2, 3, 0, 6, 99]) 10 | t.deepEqual(makeIntcode([2, 4, 4, 5, 99, 0]), [2, 4, 4, 5, 99, 9801]) 11 | t.deepEqual(makeIntcode([1, 1, 1, 4, 99, 5, 6, 0, 99]), [30, 1, 1, 4, 2, 5, 6, 0, 99]) 12 | }) 13 | 14 | test('makeIntcodeFromFile', function (t) { 15 | t.plan(2) 16 | 17 | makeIntcodeFromFile(path.join(__dirname, 'input.test.txt'), (err, intcode) => { 18 | t.error(err) 19 | t.deepEqual(intcode, [3500, 9, 10, 70, 2, 3, 11, 0, 99, 30, 40, 50]) 20 | }) 21 | }) 22 | 23 | test('findInputsForTarget', function (t) { 24 | t.plan(2) 25 | 26 | findInputsForTarget(path.join(__dirname, 'input.txt'), 3166704, (err, nounAndVerb) => { 27 | t.error(err) 28 | t.deepEqual(nounAndVerb, [12, 2]) 29 | }) 30 | }) 31 | -------------------------------------------------------------------------------- /2019/day 1/test.js: -------------------------------------------------------------------------------- 1 | const test = require('tape') 2 | const path = require('path') 3 | const { calculateFuel, calculateFromInput, calculateFuelRecursive, calculateFromInputRecursive } = require('./') 4 | 5 | test('calculateFuel', function (t) { 6 | t.plan(4) 7 | 8 | t.equal(calculateFuel(12), 2) 9 | t.equal(calculateFuel(14), 2) 10 | t.equal(calculateFuel(1969), 654) 11 | t.equal(calculateFuel(100756), 33583) 12 | }) 13 | 14 | test('calculateFromInput', function (t) { 15 | t.plan(2) 16 | 17 | calculateFromInput(path.join(__dirname, 'input.test.txt'), (err, fuel) => { 18 | t.error(err) 19 | t.equal(fuel, 658) 20 | }) 21 | }) 22 | 23 | test('calculateFuelRecursive', function (t) { 24 | t.plan(3) 25 | 26 | t.equal(calculateFuelRecursive(14), 2) 27 | t.equal(calculateFuelRecursive(1969), 966) 28 | t.equal(calculateFuelRecursive(100756), 50346) 29 | }) 30 | 31 | test('calculateFromInputRecursive', function (t) { 32 | t.plan(2) 33 | 34 | calculateFromInputRecursive(path.join(__dirname, 'input.test.txt'), (err, fuel) => { 35 | t.error(err) 36 | t.equal(fuel, 970) 37 | }) 38 | }) 39 | -------------------------------------------------------------------------------- /2019/day 1/input.txt: -------------------------------------------------------------------------------- 1 | 66626 2 | 95053 3 | 84365 4 | 111504 5 | 97412 6 | 124986 7 | 133224 8 | 60267 9 | 68096 10 | 120910 11 | 105547 12 | 138575 13 | 112841 14 | 113102 15 | 92387 16 | 83511 17 | 62646 18 | 98974 19 | 138093 20 | 59417 21 | 137854 22 | 78318 23 | 143846 24 | 81514 25 | 86217 26 | 98493 27 | 82056 28 | 129376 29 | 61322 30 | 51045 31 | 115467 32 | 106540 33 | 149439 34 | 141253 35 | 65608 36 | 130480 37 | 79444 38 | 80032 39 | 101908 40 | 105695 41 | 145502 42 | 87538 43 | 68817 44 | 128768 45 | 148784 46 | 115464 47 | 147306 48 | 148666 49 | 118258 50 | 82755 51 | 68422 52 | 98333 53 | 105334 54 | 120963 55 | 89349 56 | 78675 57 | 99151 58 | 61383 59 | 81549 60 | 106544 61 | 72880 62 | 88152 63 | 110879 64 | 91277 65 | 123584 66 | 78430 67 | 51658 68 | 126045 69 | 93833 70 | 52535 71 | 130831 72 | 130920 73 | 80069 74 | 140263 75 | 50943 76 | 63503 77 | 116135 78 | 112686 79 | 67582 80 | 83515 81 | 128736 82 | 136447 83 | 69998 84 | 72472 85 | 61009 86 | 136054 87 | 124675 88 | 134813 89 | 149765 90 | 132135 91 | 127787 92 | 148333 93 | 78020 94 | 94212 95 | 81407 96 | 58994 97 | 146820 98 | 66603 99 | 62761 100 | 86955 -------------------------------------------------------------------------------- /2019/day 1/index.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs') 2 | 3 | exports.calculateFuel = calculateFuel 4 | exports.calculateFuelRecursive = calculateFuelRecursive 5 | exports.calculateFromInput = calculateFromInputFactory(calculateFuel) 6 | exports.calculateFromInputRecursive = calculateFromInputFactory(calculateFuelRecursive) 7 | 8 | /** 9 | * 10 | * @param {number | string} mass The mass of the module 11 | * @returns {number} The fuel for the module 12 | */ 13 | function calculateFuel (mass) { 14 | if (typeof mass === 'string') { 15 | mass = parseInt(mass, 10) 16 | if (isNaN(mass)) return 0 17 | } 18 | const fuel = Math.floor(mass / 3) - 2 19 | return fuel > 0 ? fuel : 0 20 | } 21 | 22 | /** 23 | * 24 | * @param {number} mass Initial mass 25 | */ 26 | function calculateFuelRecursive (mass) { 27 | if (mass <= 0) return 0 28 | const currentFuel = calculateFuel(mass) 29 | return currentFuel + calculateFuelRecursive(currentFuel) 30 | } 31 | 32 | /** 33 | * 34 | * @param {string} fn The function to run on each line of the file 35 | * @returns {Function} 36 | */ 37 | function calculateFromInputFactory (fn) { 38 | return (input, cb = console.log) => { 39 | fs.readFile(input, 'utf8', (err, data) => { 40 | if (err) cb(err) 41 | let totalFuel = 0 42 | for (const moduleMass of data.split('\n')) { 43 | totalFuel += fn(moduleMass) 44 | } 45 | cb(null, totalFuel) 46 | }) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | Copyright (c) 2019 Yerko Palma 2 | 3 | The following license is modified from the MIT license. 4 | 5 | ANTI-FASCIST LICENSE: 6 | 7 | The following conditions must be met by any person obtaining a copy of this 8 | software: 9 | 10 | - You MAY NOT be a fascist. 11 | - You MUST not financially support fascists. 12 | - You MUST not publicly voice support for fascists. 13 | 14 | "Fascist" can be understood as any entity which supports radical authoritarian 15 | nationalism. Example: Donald Trump is a fascist, if you donated to his 16 | campaign then all rights provided by this license are not granted to you. 17 | 18 | MIT LICENSE: 19 | 20 | Permission is hereby granted, free of charge, to any person obtaining a copy 21 | of this software and associated documentation files (the "Software"), to deal 22 | in the Software without restriction, including without limitation the rights 23 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 24 | copies of the Software, and to permit persons to whom the Software is 25 | furnished to do so, subject to the following conditions: 26 | 27 | The above copyright notice and this permission notice shall be included in all 28 | copies or substantial portions of the Software. 29 | 30 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36 | SOFTWARE. -------------------------------------------------------------------------------- /2019/day 2/index.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs') 2 | 3 | exports.makeIntcode = makeIntcode 4 | exports.makeIntcodeFromFile = makeIntcodeFromFile 5 | exports.findInputsForTarget = findInputsForTarget 6 | 7 | /** 8 | * 9 | * @param {number[]} intcode The input program 10 | * @returns {number[]} the corrected program 11 | */ 12 | function makeIntcode (intcode) { 13 | let i = 0 14 | let previousIntcode 15 | while (intcode) { 16 | previousIntcode = intcode 17 | intcode = processFour(intcode, i) 18 | i += 4 19 | } 20 | return previousIntcode 21 | } 22 | 23 | /** 24 | * 25 | * @param {string} inputFile The source of the input file 26 | * @param {Function} cb A callback with the result intcode 27 | */ 28 | function makeIntcodeFromFile (inputFile, replacements, cb) { 29 | if (typeof replacements === 'function') { 30 | cb = replacements 31 | replacements = null 32 | } 33 | fs.readFile(inputFile, 'utf8', (err, data) => { 34 | if (err) cb(err) 35 | data = data.split(',').map(n => parseInt(n, 10)) 36 | if (replacements) { 37 | for (const replace in replacements) { 38 | data[replace] = replacements[replace] 39 | } 40 | } 41 | cb(null, makeIntcode(data)) 42 | }) 43 | } 44 | 45 | /** 46 | * 47 | * @param {string} inputFile The source file 48 | * @param {number} target The number to search for 49 | * @param {Function} cb The callback with resulting noun and verb 50 | */ 51 | function findInputsForTarget (inputFile, target, cb) { 52 | fs.readFile(inputFile, 'utf8', (err, data) => { 53 | if (err) cb(err) 54 | data = data.split(',').map(n => parseInt(n, 10)) 55 | for (let noun = 0; noun < 100; noun++) { 56 | for (let verb = 0; verb < 100; verb++) { 57 | const copy = Object.assign([], data) 58 | copy[1] = noun 59 | copy[2] = verb 60 | const intcode = makeIntcode(copy)[0] 61 | if (intcode === target) { 62 | cb(null, [noun, verb]) 63 | return 64 | } 65 | } 66 | } 67 | cb(new Error('No input possible')) 68 | }) 69 | } 70 | 71 | function processFour (source, index) { 72 | if (Array.isArray(source) && source.length >= 1) { 73 | let result 74 | const opcode = source[index] 75 | const input1 = source[index + 1] 76 | const input2 = source[index + 2] 77 | const output = source[index + 3] 78 | 79 | if (opcode === 1) { 80 | result = source[input1] + source[input2] 81 | source[output] = result 82 | } 83 | if (opcode === 2) { 84 | result = source[input1] * source[input2] 85 | source[output] = result 86 | } 87 | if (opcode === 99) { 88 | return null 89 | } 90 | return source 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /2019/day 1/README.md: -------------------------------------------------------------------------------- 1 | # Day 1: The Tyranny of the Rocket Equation 2 | 3 | ## Part one 4 | 5 | Santa has become stranded at the edge of the Solar System while delivering 6 | presents to other planets! To accurately calculate his position in space, 7 | safely align his warp drive, and return to Earth in time to save Christmas, 8 | he needs you to bring him measurements from **fifty stars**. 9 | 10 | Collect stars by solving puzzles. Two puzzles will be made available on 11 | each day in the Advent calendar; the second puzzle is unlocked when you 12 | complete the first. Each puzzle grants **one star**. Good luck! 13 | 14 | The Elves quickly load you into a spacecraft and prepare to launch. 15 | 16 | At the first Go / No Go poll, every Elf is Go until the Fuel Counter-Upper. 17 | They haven't determined the amount of fuel required yet. 18 | 19 | Fuel required to launch a given _module_ is based on its _mass_. 20 | Specifically, to find the fuel required for a module, take its mass, 21 | divide by three, round down, and subtract 2. 22 | 23 | For example: 24 | 25 | - For a mass of `12`, divide by 3 and round down to get `4`, then subtract 2 to 26 | get `2`. 27 | - For a mass of `14`, dividing by 3 and rounding down still yields `4`, so the 28 | fuel required is also `2`. 29 | - For a mass of `1969`, the fuel required is `654`. 30 | - For a mass of `100756`, the fuel required is `33583`. 31 | 32 | The Fuel Counter-Upper needs to know the total fuel requirement. To find it, 33 | individually calculate the fuel needed for the mass of each module (your 34 | puzzle input), then add together all the fuel values. 35 | 36 | _What is the sum of the fuel requirements_ for all of the modules on your spacecraft? 37 | 38 | ## Part two 39 | 40 | During the second Go / No Go poll, the Elf in charge of the Rocket Equation 41 | Double-Checker stops the launch sequence. Apparently, you forgot to include 42 | additional fuel for the fuel you just added. 43 | 44 | Fuel itself requires fuel just like a module - take its mass, divide by three, 45 | round down, and subtract 2. However, that fuel _also_ requires fuel, and _that_ fuel 46 | requires fuel, and so on. Any mass that would require _negative fuel_ should 47 | instead be treated as if it requires _zero fuel_; the remaining mass, if any, is 48 | instead handled by _wishing really hard_, which has no mass and is outside the scope 49 | of this calculation. 50 | 51 | So, for each module mass, calculate its fuel and add it to the total. Then, treat 52 | the fuel amount you just calculated as the input mass and repeat the process, 53 | continuing until a fuel requirement is zero or negative. For example: 54 | 55 | - A module of mass `14` requires `2` fuel. This fuel requires no further fuel (2 divided 56 | by 3 and rounded down is `0`, which would call for a negative fuel), so the total fuel 57 | required is still just `2`. 58 | - At first, a module of mass `1969` requires `654` fuel. Then, this fuel requires `216` more 59 | fuel (`654 / 3 - 2`). `216` then requires `70` more fuel, which requires `21` fuel, which 60 | requires `5` fuel, which requires no further fuel. So, the total fuel required for a 61 | module of mass `1969` is `654 + 216 + 70 + 21 + 5 = 966`. 62 | - The fuel required by a module of mass `100756` and its fuel is: `33583 + 11192 + 3728 + 63 | 1240 + 411 + 135 + 43 + 12 + 2 = 50346`. 64 | 65 | 66 | _What is the sum of the fuel requirements_ for all of the modules on your spacecraft 67 | when also taking into account the mass of the added fuel? (Calculate the fuel 68 | requirements for each module separately, then add them all up at the end.) -------------------------------------------------------------------------------- /2019/day 2/README.md: -------------------------------------------------------------------------------- 1 | # Day 2: 1202 Program Alarm 2 | 3 | On the way to your [gravity assist][gravity assist] around the Moon, your ship 4 | computer beeps angrily about a "[1202 program alarm][1202 program]". On the 5 | radio, an Elf is already explaining how to handle the situation: "Don't 6 | worry, that's perfectly norma--" The ship computer 7 | [bursts into flames][burst into flames]. 8 | 9 | You notify the Elves that the computer's [magic smoke][magic smoke] seems to 10 | have escaped. "That computer ran _Intcode_ programs like the gravity assist program 11 | it was working on; surely there are enough spare parts up there to build a new 12 | Intcode computer!" 13 | 14 | An Intcode program is a list of [integers][integers] separated by commas (like 15 | `1,0,0,3,99`). To run one, start by looking at the first integer (called 16 | position `0`). Here, you will find an _opcode_ - either `1`, `2`, or `99`. The 17 | opcode indicates what to do; for example, 99 means that the program is finished 18 | and should immediately halt. Encountering an unknown opcode means something 19 | went wrong. 20 | 21 | Opcode `1` _adds_ together numbers read from two positions and stores the result 22 | in a third position. The three integers _immediately after_ the opcode tell you 23 | these three positions - the first two indicate the _positions_ from which you 24 | should read the input values, and the third indicates the _position_ at which 25 | the output should be stored. 26 | 27 | For example, if your Intcode computer encounters `1,10,20,30`, it should read 28 | the values at positions `10` and `20`, add those values, and then overwrite 29 | the value at position `30` with their sum. 30 | 31 | Opcode `2` works exactly like opcode `1`, except it _multiplies_ the two inputs 32 | instead of adding them. Again, the three integers after the opcode indicate 33 | _where_ the inputs and outputs are, not their values. 34 | 35 | Once you're done processing an opcode, _move to the next one_ by stepping 36 | forward `4` positions. 37 | 38 | For example, suppose you have the following program: 39 | 40 | `1,9,10,3,2,3,11,0,99,30,40,50` 41 | 42 | For the purposes of illustration, here is the same program split into multiple 43 | lines: 44 | 45 | ``` 46 | 1,9,10,3, 47 | 2,3,11,0, 48 | 99, 49 | 30,40,50 50 | ``` 51 | 52 | The first four integers, `1,9,10,3`, are at positions `0`, `1`, `2`, and `3`. 53 | Together, they represent the first opcode (`1`, addition), the positions of the 54 | two inputs (`9` and `10`), and the position of the output (`3`). To handle this 55 | opcode, you first need to get the values at the input positions: position `9` 56 | contains `30`, and position `10` contains `40`. _Add_ these numbers together to 57 | get `70`. Then, store this value at the output position; here, the output 58 | position (`3`) is _at_ position `3`, so it overwrites itself. Afterward, the 59 | program looks like this: 60 | 61 | ``` 62 | 1,9,10,70, 63 | 2,3,11,0, 64 | 99, 65 | 30,40,50 66 | ``` 67 | 68 | Step forward `4` positions to reach the next opcode, `2`. This opcode works just 69 | like the previous, but it multiplies instead of adding. The inputs are at 70 | positions `3` and `11`; these positions contain `70` and `50` respectively. 71 | Multiplying these produces `3500`; this is stored at position `0`: 72 | 73 | ``` 74 | 3500,9,10,70, 75 | 2,3,11,0, 76 | 99, 77 | 30,40,50 78 | ``` 79 | 80 | Stepping forward `4` more positions arrives at opcode `99`, halting the program. 81 | 82 | Here are the initial and final states of a few more small programs: 83 | 84 | - `1,0,0,0,99` becomes `2,0,0,0,99` (`1 + 1 = 2`). 85 | - `2,3,0,3,99` becomes `2,3,0,6,99` (`3 * 2 = 6`). 86 | - `2,4,4,5,99,0` becomes `2,4,4,5,99,9801` (`99 * 99 = 9801`). 87 | - `1,1,1,4,99,5,6,0,99` becomes `30,1,1,4,2,5,6,0,99`. 88 | 89 | Once you have a working computer, the first step is to restore the gravity assist 90 | program (your puzzle input) to the "1202 program alarm" state it had just before 91 | the last computer caught fire. To do this, _before running the program_, replace 92 | position 1 with the value 12 and replace position 2 with the value 2. _What value 93 | is left at position 0_ after the program halts? 94 | 95 | [gravity assist]: https://en.wikipedia.org/wiki/Gravity_assist 96 | [1202 program]: https://www.hq.nasa.gov/alsj/a11/a11.landing.html#1023832 97 | [burst into flames]: https://en.wikipedia.org/wiki/Halt_and_Catch_Fire 98 | [magic smoke]: https://en.wikipedia.org/wiki/Magic_smoke 99 | [integers]: https://en.wikipedia.org/wiki/Integer --------------------------------------------------------------------------------