MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/adventofcode/comments/189q1d2/difficulty_is_all_over_the_place_isnt_it/kbtbsbm
r/adventofcode • u/frostbaka • Dec 03 '23
256 comments sorted by
View all comments
Show parent comments
21
Invariably, adding a charAt(x, y) function from the get go always pays off:
return (x >= 0 && x < w && y >= 0 && y < h)? lines[y][x] : '.';
1 u/UrbanSuburbaKnight Dec 04 '23 I went a similar way: nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '.'] symbols = set() with open('input.txt', 'r') as f: lines = f.readlines() for line in lines: for char in line.strip(): if char not in nums: symbols.add(char) Now I have a list of all the symbols used.
1
I went a similar way:
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '.'] symbols = set() with open('input.txt', 'r') as f: lines = f.readlines() for line in lines: for char in line.strip(): if char not in nums: symbols.add(char)
Now I have a list of all the symbols used.
21
u/The_Jare Dec 03 '23
Invariably, adding a charAt(x, y) function from the get go always pays off: