Skip to content

Instantly share code, notes, and snippets.

@wcarroll
Last active December 1, 2019 23:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wcarroll/caca038197111704c31a3620a80979fe to your computer and use it in GitHub Desktop.
Save wcarroll/caca038197111704c31a3620a80979fe to your computer and use it in GitHub Desktop.
Advent of Code 2019 - Day 1 - Problem 1 Solution
Function Get-Fuel ($PayloadMass) {
[Math]::Floor($PayloadMass / 3) - 2
}
$PayloadMasses = Get-Content .\PayloadMasses.txt
$TotalRequiredFuel = 0
foreach ($PayloadMass in $PayloadMasses) {
$TotalRequiredFuel += Get-Fuel($PayloadMass)
}
Write-Output "Total Required Fuel: $TotalRequiredFuel"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment