AdventOfCode2020/Advent Of Code Day 3.ps1
2020-12-08 09:51:11 -06:00

342 lines
11 KiB
PowerShell

$map = @("...#.....#.......##......#.....",
"...#..................#........",
"....##....#.......#............",
".........#.......#.......#.....",
"..#..............#.........#..#",
".....#.........#....#....#....#",
"....##..........#.#.##.........",
"...#....##...#...#...#.#..#....",
"...#.......###..........#......",
".........#.....#....#...#.#....",
".#...###..#..##..#.........###.",
"#.#...#..........###...#....#..",
"#....#.#..#..........#.......#.",
".#..#........##.#..............",
"............#..#.#............#",
".............#..........#......",
"...#.......#...............#...",
".#...#..#..#............#..#...",
"....##.##..................#.##",
"#......#...#..##....#.....#...#",
"#..#..........##....#...###....",
"##......#.##.#......#..#......#",
"....#...#.......##.##...#.#..#.",
"##.#...#....#...#...#........#.",
"........#..#.....#....#.......#",
".#......#......#..............#",
".#.....#..#..#..#..#..#....#..#",
".......#.....#.................",
".#......#...#..#..#...#...#....",
".........#..#..#.........#.....",
".....#.........#.#..........#..",
"#......#....#....##....#.#.#...",
"................##.#...........",
".....##.....#............#.#...",
"...........#...#.#..##...#.....",
".......#....##.......#..#....#.",
".##......##....#....####.##..#.",
".....#.##.....#...#....##......",
".............#....#......#....#",
"#.#.#.###........#.#....#.#....",
".##...........#................",
"#..#..#...##..##.##...#..#.#...",
"..#......##..#.#......#..#.#.#.",
".....#..............#......#...",
"#.#..##.##...#............##...",
".#......#.............#........",
"........##....#......#..#......",
"##.........##....#..........#..",
"..#..#....#.........##....#..#.",
"........#..#..#........#...#...",
"#.........#......##.#...#.##...",
".##.............#..###....#.##.",
".##.#....#.......#.............",
"#..##.#.........#..##.#......##",
"....#..#.......................",
".#.#.........#...............#.",
"....#......#.#..##..#...#.#..#.",
"#....##...##..#.......##.....##",
"....##...##...#....#.....#..#..",
".#......#.#.#.#......##..#..#..",
".....##..#..#.....#.....#...##.",
"....###................#..#.#..",
".....#..#..#.#..........#..#...",
"...#.....#............#........",
"#.............#...#..#.....#..#",
"#........#.....#.#..#......#...",
"...#.##.....#.#..#.........#..#",
".......##...#..#.#....##.......",
"..................#..##..#.#.#.",
"..#......#..#..#.....#...#.#...",
".#.......#.....#.#....#.#......",
"##..#.#....#.###..#...#.......#",
".......................#.......",
"..###..........#..##.##.#...##.",
".....#...#....###.........#..#.",
"..#.....#....###...............",
"....#.......#........#....#..#.",
"......#................#.#...##",
"#.....#.......#..#..........##.",
"#.#....##.........#.....#.#....",
"#.#.#...#............####.##..#",
".....#....####........#...#..#.",
"....##........#.#..............",
".#......#..#..##......#....#.##",
"..#....#.#........#..#....#....",
".#...#.##...#.#.....#.....#...#",
"..........#................###.",
".....#..........##..#..........",
".....#..................#...#..",
"#......##....#.#...#..#.......#",
"..#......##....#......#.#...#..",
"###.#..###.#.#..#...#....#.....",
"#.....#.#...#.##...#........#..",
"#..........................#...",
".#.#.....#.#.#.......##.#.#....",
".#....#..##......#....#........",
".#.......#.##......#.#..#......",
"............#.....#....##.##...",
"....##........##......#........",
"....#......##....##.....#......",
"..#.#.....#......#...#.#.......",
".###.........#...#........#....",
"......#.#...##.....##..##..#...",
"...#...#.#......#..##..#.......",
".##....#.#........#.#..........",
"#....#.#......#......#.#.#.....",
"#.....#.....#................##",
"...........#....#...#...#......",
"..........##..##..#...##.......",
".##......#.......#..#.#..##....",
"..........##....#....#..#.#....",
"...............#......#.....##.",
".#...#....................#..#.",
".............###...............",
".####..............#...#.......",
"....#...#.#...#...#....#.......",
".......#.#.....................",
"...............................",
"#..#.........##.......#.#.#....",
"....##...#...........#......#..",
"........##...#......#..........",
"....#.#.....#..#......#........",
"#..#................#..#.##....",
".#........#.......#.........##.",
"#...........#...#...#......#.#.",
"..#.#.#..........##.##...#...#.",
"..#...#.##...#.#...........#...",
"##...........##...##...##......",
"....#....##...#......#..#.....#",
"#..#.#.#..#...#...#....#.......",
"............#.....#....#....#.#",
"....##.....#.........#......#..",
".....##.......#...#...#.###....",
"...##......##..###.#.#....#....",
"#.#.#.#..#.#.........#...#...##",
"..#..........#.................",
"....##....#....................",
"###.#...............##...##.#..",
"....#.......##.#..#.#..........",
"............##..#.......##.....",
"#...#.........#..#..#..#...#...",
"..#......##..#.#...##.#.......#",
"......#................#...#...",
"......#..###............#.#....",
"..#.#...###...#..#...#......##.",
"...#.##...##............#......",
"#...##........#.#..#.......#...",
"#..#.....#..#.##...............",
"..#.....#.#....#.........#.....",
".............#....#..#...#.##..",
"..#.#.....................##.#.",
"........#.......#..#.#.........",
"##..............#.....#.......#",
".#.##...###....#.....#..##.#...",
"#..#...#..#......#..........###",
"#...........#..#...#....#....#.",
"....#..#.......##......#......#",
"#...#.#...............##...#...",
"...##.#..##.......##..#........",
"...........##..........#.......",
"..#....#..##...#......#.#......",
".#.#....#.#.#...#.#............",
".#.#..#...##.......#.#.........",
"...#...#.............#.######..",
"##.#........###.......#....#.#.",
".#....#.....#.#........#......#",
"..#.#.........#..........##.#..",
".#....#.#..............#......#",
".....#..##.........#..##..#....",
"........#..#....#.......#.....#",
"#.#.......#.....#.##.#...#....#",
"...#...##...#....#.....#....#.#",
"#..##....#..........#..#.......",
".......#.#.....#...#.#.#.....##",
"#...#...#..#......##.#..#......",
"...#.......#....#...........#.#",
"##.......#####.#.........#..#..",
"....#.#...................##...",
"......#..##............#.......",
"#.........#....#####.#.#..#.#..",
"..#......#.#.##............#...",
"..#...#.....#.#....#......#....",
".#...#....#....#.#.#......#.#..",
"..#.##.....#..........#...#.#..",
".......#...#.............#...#.",
".#.........#.....#.#........##.",
"#....#..#..........##.......##.",
"...#....#.#.........#.......###",
"......#....#.#......#.......#..",
".....#...#...#.#...##..#.#.....",
"#.........##..#...##..#.#....#.",
"...#......#.#......##.....#....",
".#####.....#.#.#.#...###.##....",
"..#................#.#...#.#...",
"#.......##...#.........##..#...",
"..#.....#....##............#...",
"#............##...............#",
"..#..#.................#.......",
"...............#..#.......##...",
"..##..#....#...##..........#..#",
"#...###....##.#.......#.....#..",
"..........#.........#..#......#",
"##....#.....#...##.......#.....",
"..#..#.......#.................",
"..#..##......#.........#......#",
"...........##.#..#......#.#..#.",
"..#...##...##......#...#...#.#.",
".#..#.....#.........#..........",
"#..##...#............#..#.#....",
"..#...#...##.#........#....#.#.",
"......##..###.#....#........#..",
".....#..#....##...##..........#",
"................#.#.#.....#..#.",
"#.##...#......#.#..#.......###.",
".......#.#..#..#......#..##..#.",
".##...#...#....#....#.......#..",
"......#..#....#.#.###.....#.#.#",
"#....#.#...#......#.#.....#..#.",
".......#.#...#.#.#............#",
"#.....#..#...#.................",
".....#..........#..#.#..#.#....",
".........#......#.#.........###",
"..#.###........#....##.#.......",
".#.......#.#......#........#..#",
"............#........#.....#...",
"......#......#....#.#....#.....",
".#.......#.....#.##.#..#...#..#",
"##.....#...#..........##..#...#",
".#........#....#...#....##.#...",
"...#.#.......#.#....#.#...#...#",
"........#.#.....#.##...#.#.#...",
"...........#....#..#.........#.",
"......#.#..#..##...#.......#...",
"...#....#..#..#.##...........##",
".#..#.#.#......#....##...#.....",
"......#..#........#...##.......",
".............#...##.#.....#...#",
"....#...............##......#.#",
".#...........#.........###.##.#",
"....##........##...#.##.....#..",
"#......##........#...........#.",
"###.#.................#.....#..",
".....##..#.........#......##.#.",
"#.#.......##.#..#...#...#......",
"...#.#..##.....#....##.....#.#.",
"...##..#...#........#.#..#..#..",
"...........#....#...#...##.....",
"##.......#...#.#.##...##..#.#..",
"#....#.#..##...................",
".#...................#.#..#....",
"#.....#..........#..#...#...#..",
"...#..#............#.#.........",
"............#..##.....##......#",
"#....#.........#.#..#..........",
"...#.#................#....#.#.",
"..#..#...#...#.#.#...#.#.#.....",
"..#.......#.............##..#.#",
"#........#.#.###.#...#..#.###..",
".......#......#..#.....####...#",
"..##....#..#...................",
"....##.#....#......#.#..#..#..#",
"#...........##...#.#.##..###...",
"##.##......#...........#....#..",
".#....#....#..#..#...##...#....",
"...##.#.#......#...............",
".....##.##...#...........#.....",
"....#...#.#.........##.#....#.#",
"#..#...........#......#........",
"..#..#.....#....#.##.......#..#",
"..#.......##.....##.......#...#",
".#.##.#..#...............#....#",
".........#...........#.........",
"..........##......#.#..........",
"..#........###....#..#...#...#.",
"....#.#...#.....#..#....#......",
"..##...##...#..#..##......##..#",
"..#..#......#....#....#...#..##",
"...#...............#..#........",
"....##..#...#......#........#..",
"###.....##.......#.............",
".#.#.##........##..#...#.......",
".....###............#..#..#....",
".#....##.#...####........#.....",
"............#.#.....##....#.#..",
"....#..........#...#...........",
"........#.#...#..##...........#",
"#.......#..#.......###...#....#",
"#....#..#......#.....#...##.#..",
"..#.............#.#.###...##..#",
".#.#....#...#.....#...#.......#",
".##.#..#.........#..#......#...",
"#....#...#......#.....#.....#..",
"...........#....#.......##...#.",
"#.#..##....#....#.#.......#.#..",
"..............#.#..##.##.......",
"....#........#......#....#.#...",
"......#.....................#..",
"#..##...##.....#.........#.....",
"#.....#.....#....#...#.....#...",
"........###...........#...#....",
"............#.....#...##....#..",
".......#.......#...#.#...##....",
"..#.#..#....#...#...#....#.....",
"..........#.#....#....###....#.",
".##...#......###..#............",
"...#...#........#....#....##...",
"##.....#.##...#.#...........#.#",
"..........#.#....#...##.#...#..",
"..#....#.#...#...#....#.###....",
"......#.##..#..#.........#.###.",
"#.#.#.....#.....##.......#.....",
"...#..#..#....#.#....#....#....",
"##..#.#................#......#",
".....#...#..#......#..####.....",
".....##.....#....####......#...",
"..........##..###.#....#.....##",
"###...#.......#......##...#....",
".......##...#...#..#.##.#....##",
".....##.....##...##.....#..#..#",
"......#.#.....#...#....#...#...",
"..##........#...#..............",
"..#........#.##.........#...#..",
"#....#....#................#..."
)
$rightby=1
$pos=0
$downby=2
$trees=0
for($i=0;$i -le $map.count - 1; $i= $i + $downby){
$line = $map[$i]
if($pos -gt 30){
$pos=$pos-31
}
write-host $pos
write-host $line
if($line[$pos] -eq "#"){
write-host $line[$pos]
$trees++
}
$pos = $pos + $rightby
}
$trees