-
Notifications
You must be signed in to change notification settings - Fork 0
/
3a.js
27 lines (21 loc) · 11.5 KB
/
3a.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
var map = ['.........#..##..#..#........#..', '#...#..#..#...##.....##.##.#...', '....#..............#....#....#.', '#.#..#.....#...#.##..#.#.#.....', '........#..#.#..#.......#......', '.#........#.#..###.#....#.#.#..', '........#........#.......#.....', '...##..#.#.#........##.........', '#.#.##..###............#...#...', '............#....#.......###.##', '....##....##..#........#......#', '............#.#..........#.....', '#.#....#....##...#.....#.....#.', '......#.#.#...#.....###....#..#', '...........##..#.........#..#.#', '..#..#.................#..#..#.', '.#....###...#.......#.........#', '#.#.#.#...#......#.......#...#.', '.......#.#.#...#..............#', '...##.......#..##.#.......##...', '#.#.##....#..##..##..###...###.', '.#......##.##.#....#.##........', '..###.............##..##..#....', '.....#.#...........#..##..##...', '.###.#.#......#.....#........##', '...#.......#...##..#..#..#.....', '..............#.#..##.##..##..#', '#..#.#......#............#.....', '........#..#....#..............', '...#...#..............#.#####..', '...##......#........#.#...#....', '..##......#............#..#..#.', '....#.........#.#.#.....###.#..', '#....#........#........#....#.#', '.....#...#..##.....##...#.....#', '#...#.#.#...##..##.###.#.#.....', '......#.#..........#...#.##....', '..............##...#..#.......#', '........##.....#.....#.#....#..', '..............#..#..#...#.....#', '##......##.......##...#.#....#.', '.....#.............#.#.........', '#.........##..#..#.........##..', '..#..#.....#####.........##.#..', '.......##.#......#........#....', '#.................#.#...#....#.', '...#........#.###.##.##.....#..', '#.....##..#...##.#.#......#....', '.....#..#.#..........##..#.##..', '..###.............#..#..#...#..', '...###..#...#.....##..........#', '#.......#.#...#....#..##..#..#.', '.#..#.........#..............#.', '..######.....#....##......#....', '#..##...#......#..#.#....#.....', '.#...................#.#.....#.', '..#...#.#..#.#......#..#...#..#', '..##..##.#.##.........#.#.#....', '...#...#...........#..##.##...#', '#...#....#....#....#..#.##..#..', '..#.##....#....###..#..........', '#.#..##.#.#...##.#..#.##..#.#..', '#......##...#.#..........#..#..', '#.#...#..#...#.#.#..#........#.', '#.#.##.#..#...#..#.#.##........', '.....#......#........#..#......', '...#....#.#....#...............', '....#..###..#....#..#....#....#', '.#........###..........##.##.#.', '#.#......##....##...##.#......#', '#..##.##...#...........##.#.#..', '.#.....#.#...#.................', '##..........#..#....#.....#...#', '....#.#..........##..#.....#.##', '#.#..#..#..##..........#.......', '..#.#.###......................', '......##..##.....#..##.##....#.', '...#.......#.##....#......#....', '...#...#........#...#.#...#..##', '##...#....#.#...#.#.##..##...#.', '...#.....#...#...#....###.#..#.', '..#.#..#........#......#..##..#', '...#......#...#.#.##...##.#.#.#', '....#.#....#....#.....#.....##.', '.....#.#..##.#....##....##.....', '.#...###..#.....#............#.', '#..#.#.#..#..#...#....#...#....', '#.....#..#...#................#', '..........#..#.......#......#.#', '...#..#......#...#......#......', '.#.#.....#.#.#.#......#..#..#..', '.....#.........#.#.#.....##.#..', '.....#.#.....#..#..#..#.....###', '##....#......##....##.#....#.#.', '#####........#..........##.....', '.#...##...#...#.......#....#...', '#.#.##...##...##..##........#..', '#.#..............#.#...#...###.', '...#.....##..#.........#....#.#', '#.#....#....#..##.#..#...#.....', '..#....#.#..#...#...##.....#...', '....#...#......................', '..#...#.......#..#...##....#...', '.#........#...#.....##.##...#..', '#......#..............#..#..#..', '...........#.#..#.#.#....#....#', '.##..##.......#...#..#.....#..#', '...#.........#.........###..#..', '...#.##....#....#.....#.....#..', '.#.#.#.........#.#.#....#....#.', '...#..........##..#....#.#.....', '...#....##................#....', '#....##..#..#........##...#....', '#...#...##.#............#....#.', '##..#....#...#...............#.', '..........#.#...#..##..#.#.....', '..##...##..#....#.#......#.....', '.......#......#.#.....#.....##.', '#...###.....##..##....#.#....#.', '.###......#.....#.#............', '#.....#.....####.##....#..#....', '......###.............#......##', '.........##.......##..#..#..#..', '.#.......#....#...#...#.#......', '#...#..#...#........#...##..#..', '.#....#........#.........##..#.', '..............##.#...##..#.##.#', '.#....#...#....#......#..#.....', '#....##.#...#.#.....###..#....#', '#.......##.#..###..............', '#..#..#..#......#.#..#...#..#.#', '.......#.#.#..#..#...#..#......', '.#..#......#.....#......##..##.', '....#....#.......#.......#.#.##', '.......#.#................#...#', '#.#.....#.......#.#........#...', '.....#....##...#......#.....##.', '.#......#.#...#..#....#....#.##', '##...#.###.#....#..#....#.#...#', '....#.##..##.#.............#...', '#..#.............##.......#.#..', '##.#..#..#.#...........###...##', '.#.#.....#......###........#...', '#.#...#.#....##......#.#....#..', '#.........#..........#.........', '.......#....#...#..#.....#...##', '.......................#...#..#', '.###...........##...#........##', '#.#....######.#........#..##.#.', '..#.##.#...#.#.......#.##.##..#', '#.............###..#.##.#......', '...#..##......#...#..###.....#.', '..........#.....#..#...##..#...', '..##..........#.#..#.....#...#.', '...#.......#.....##.........#..', '#..#.#...#..#...###...#...#.#..', '#.##....#..#.#.......#..#..#...', '..#.##.#......#.#......#....#..', '..........#...##.....###.......', '...#...##..#......#...##.......', '....#........#.#.......#..###..', '.....#.#..........##.#..#..#.#.', '.............##.....#.#..##....', '...#...............##...#......', '....#......#..#....#...##..#...', '.##.#....#.#.....#.#.........#.', '.....#.###....#..###..#.#.....#', '.#.........##.........##...#...', '..#.....###....##..........#..#', '........#..#.#.#..#.......#..##', '..#.#..#.#............#.##.#..#', '.#....#.....#..#...#.......##..', '.#...........#.#..#..###.###...', '..#.....#..#........#.#........', '.#........##........#..#.##....', '......#.....##........##..#....', '.#..................##....#.#..', '.#..#.#..#.#...#........#......', '...#..##.#......#..#..........#', '....#.##...#....##.............', '#....#.##....##.###..#..#..#...', '..........#..#...##.##....#..#.', '.###.#.....#...#...#...#.......', '............#...............#.#', '#....#...#......#....#.#.#.#.##', '...#..........#.#.#.....###....', '#.#...##...#..#.....###...#....', '......#...#..#..#..#.##...##...', '...#..#.#....#...#.#.........##', '##....#..###.#.##.....##.......', '..#.#...#..##.......#.#.......#', '##......#...........#......#...', '.......#..###....###..##.#...##', '.........#.....#..#.......##..#', '.......#.##..#....#...#.#...#..', '#..#.#..................##.#..#', '...#..#..#.....#..#........#...', '...#.#..###..#.....##...#....#.', '..#..#......#...........#...#..', '#...##.##..###.......##........', '.#.....#..#....#.....#.##....#.', '#..#........#.#....#..#...#.###', '..#...#.#.#.....#.....#..#.....', '.##.............#.#......##...#', '.#....#####............#.....##', '#.###.......#.#...##.....#.....', '......#.##..#...#..#..##.#..##.', '......#.#...##.....#...#....##.', '....#............#...#...#....#', '.........##.#.#....#....#....##', '.#...##.#...#.......#.##....#.#', '#....#.#...#.#...#.#.#...#.....', '.#.#.........##..#..#..........', '.#.........#.#.....#..#.#..###.', '....##.#.#..........#..####....', '....#..#.#.#...#...#..#....#...', '..#.#...#...##.......#.#.#..#..', '...##...#......#.....#.#...#..#', '......#.###.#.......##...#...#.', '.....#.#.#......##..........###', '##.#.#.#..#....#...............', '.#.#.##.......#....#.#.....#..#', '.........#...#.#..#.......#....', '....#.####.#......#...#...##...', '#..#..#..#..#....#...##.....##.', '......####.#..##..#.....##.....', '##.#.........#........#..#.#...', '.#.#....#....#.......#.#....##.', '....#....#.......##..#.....#...', '.#......#..#....#.#............', '#..#.#.##.....#..#.#.#.#.#.##..', '.#.....#.....#...#..#.#...#.#..', '.#.#.##............#.#.#.#.#.#.', '.##..........#.....#...###.....', '#.#...#...#................#.#.', '##...#.##.....#.....#.#.##.....', '####.....##..........#......#..', '#.............#..............#.', '.###....#.#...#..#..#..#.......', '..#.#.....#...#..#..####.......', '...#.#..#........#..##..#..#.##', '.#........#..........#.#...##..', '.#.......#.#.#..#...#..#.#...##', '.#.....##......##..............', '......#..#.#.##...##.#.....#...', '.........#.#...##.....##....#.#', '.....##...#........#..#.#..#.#.', '.#.##..#.....##...#...###.#.#..', '...##...#...#..#.#..#..........', '##..............#...#...#.#..#.', '......#..#......#..#.....#...#.', '.......#...#..#....#.....#.....', '..##.....##..#.#........#......', '.###.#...#.....................', '..#...#.................#...#..', '#..#.##...####.............#...', '.##....#..####.......#.........', '#..#...###...#...#..#..##......', '....#.##.#.#.........#.....#..#', '.....#...#.....#.#.#.##.#...##.', '.............#........#.....#..', '...##.###.#....##.......#..#...', '#..#....#....#.#............#..', '.........#.##........##.....#..', '.........#.#.#..#..#.......#...', '.......#.#..#.......#.....#.#..', '##.#.....##...##.....#.#.......', '.#.#.#......##.##.#.........#..', '..#.##..###.....###.........##.', '.#......#..#..##...#.#...##.#.#', '......#.#............#.....#...', '###.#..#..#..#..#.##...#.......', '.#.#.##..###....#......##..###.', '#...#.#.#..#..#..##.#.##....#..', '..#...#...####...#......####.##', '..##.#.####........#..#......#.', '.#..#.......#...#.#.........#..', '........#.#....#..#####..#.....', '.#...........#..#..#..#...#....', '....#....#...#.................', '....##..#....##....#..#....#.##', '....#.##.....###...#...##.##...', '......##.#..##.#.#.#....#.#.#..', '##.#...###....#.#..#.#.###....#', '......###..#..#..........##...#', '..........#.##...##..#....##.#.', '.#...#.#..#.#.#..#.....#.......', '.#....#..#.#..#.#...##.#.#.....', '.##.....#...#..##.#........#...', '....#......#.........#....#..##', '.#..#.#.#.#..#..#.#.........#..', '.........#.....#...#....#......', '#..#..#........#...#.#.........', '...#.#.#...##.#.#...#..#......#', '#.#.#.#........#...#..#.....#..', '.###..#..#..###..#..#..........', '.....#......#.#..#...#.......#.', '##.##.........#.......##.......', '#...##.......#..#.#.......#....', '#..#..#.....#...#......#.......', '.#..#..#.##....#.#..#...#...#..', '.#...#.....#..#.........#..#...', '...#.#.#.......#....#..##.....#', '.........#..##.#..#..#.#.......', '#.##.....##..###..#..#..#.##...', '........#......#...##...###..##', '.##....##..#..#..###......#....', '............##......#...#..##..', '...##.......#......#...##.##..#', '...#..#..#.#...####.#.......#..', '..#.##..#....#......#.#.....#..', '..#.##..............#..##.....#', '.....##....#......#....#......#', '......#..#......#.........#..#.', '...#.##.###...###..#.##........', '..........####.#.##.....#..#.##', '#...##...........#...........##', '#.#..#.#....#.#..#....##......#', '.......#...#.....#......#.#.##.', '....#.##..##..........#..#.....', '#.#.#...#......#...#.....#.##.#', '........#.......#..##.....##...', '.....####.#....#.#.............'];
var m = 1;
var c = 3;
var treeCount = 0;
for (const mapLine of map) {
if (m === 1) {
m++;
continue;
}
var lineLength = mapLine.length;
if (mapLine[c] === "#") {
treeCount++;
}
console.log('Mapline ' + m + ', character ' + (c + 1) + ': ' + mapLine[c] + ' - total: ' + treeCount);
c += 3;
if (c > lineLength - 1) {
c -= lineLength;
}
m++;
}
console.log(treeCount);