2021 Day 5 Part 1 [Golang] Need help!

2021.12.08 03:23 SirPrize__ButtSacks 2021 Day 5 Part 1 [Golang] Need help!

Hi guys, im trying to implement the function to get the answer for day5 part 1 of AoC. Following below is my golang code (Only started coding in golang with AoC this year). I've tried to test my code with the example input and the results look good, however, I can't seem to get the answer for the actual input. Been debugging for a couple of hours now but not sure what went wrong.
The basic idea of my code is to encode my hashmap based on the x,y values of the ranges. I've made sure that my y-values are inclusive, and that the inputs are added for both larger->smaller and smaller->larger ranges.

```
package main import ( helpers "aoc/2021/helpers" "bufio" "fmt" "os" "regexp" "strconv" ) func parseLine(line string) [][]string { tokens := regexp.MustCompile(",| -> |\\r?\\n").Split(line, -1) if (tokens[0] != tokens[2]) && (tokens[1] != tokens[3]) { return nil } res := make([][]string, 0) left := [2]string{tokens[0], tokens[1]} right := [2]string{tokens[2], tokens[3]} res = append(res, left[:]) res = append(res, right[:]) return res } func parse() [][][]string { res := make([][][]string, 0) file, err := os.Open("./input2.txt") helpers.Check(err) reader := bufio.NewReader(file) for true { bytes, err := reader.ReadBytes('\n') if len(bytes) == 0 { break } helpers.Check(err) line := "" for i := 0; i < len(bytes); i++ { line += string(bytes[i]) } parsedRange := parseLine(line) if len(parsedRange) != 0 { res = append(res, parsedRange) } } return res } func isHorizontal(r [][]string) bool { return r[0][1] == r[1][1] } func addHorizontalRange(rangeMap map[string]int, r [][]string) { //horizontal range means we have the same y var startIdx int var endIdx int // fmt.Println(r) if r[0][0] < r[1][0] { startIdx = 0 endIdx = 1 } else { startIdx = 1 endIdx = 0 } start, err := strconv.Atoi(r[startIdx][0]) helpers.Check(err) end, err := strconv.Atoi(r[endIdx][0]) helpers.Check(err) for i := start; i <= end; i++ { rangeEncoding := strconv.Itoa(i) + "," + r[0][1] rangeMap[rangeEncoding] = rangeMap[rangeEncoding] + 1 } } func addVerticalRange(rangeMap map[string]int, r [][]string) { //vertical range means we have the same x var startIdx int var endIdx int if r[0][1] < r[1][1] { startIdx = 0 endIdx = 1 } else { startIdx = 1 endIdx = 0 } start, err := strconv.Atoi(r[startIdx][1]) helpers.Check(err) end, err := strconv.Atoi(r[endIdx][1]) // fmt.Println(start, end) helpers.Check(err) for i := start; i <= end; i++ { rangeEncoding := r[0][0] + "," + strconv.Itoa(i) rangeMap[rangeEncoding] = rangeMap[rangeEncoding] + 1 } } func FindOverlaps() { ranges := parse() rangeMap := make(map[string]int, 0) for i := 0; i < len(ranges); i++ { if isHorizontal(ranges[i]) { addHorizontalRange(rangeMap, ranges[i]) } else { addVerticalRange(rangeMap, ranges[i]) } } overlaps := 0 for _, v := range rangeMap { if v > 1 { overlaps += 1 } } fmt.Println(rangeMap) fmt.Println(overlaps) }
```
submitted by SirPrize__ButtSacks to adventofcode [link] [comments]


2021.12.08 03:23 KSoloJD Chess. I need chess books.

Does anyone have any knowledge about chess? Would like to read some good chess books.
submitted by KSoloJD to suggestmeabook [link] [comments]


2021.12.08 03:23 ShruchWroiags NEW moonshot launch in 2 days!!| I think that this meme coin can explode this weekend | Know it | 15 BNB in liquidity and Locked for 7 months

ElegantDoge $EDOGE This is an early project and an get x50 minimum. You need to know it this week. Here’s some information about the $EDOGE Token. Sale is on December 10th, 2021 14:00 UTC We are hosting our Fairlaunch on PancakeSwap V2 (PUBLIC SALE) Initial liquidity is 15BNB Max Buy: 0.6 BNB at start. Min Buy: Dont have Min Buy. Liquidity is locked for 12 Months. Sale Rate 1 BNB = 920.000.000.000 $EDOGE Our Tokenomics are: 50% Public Fairlaunch 2.5% NFT Creation and MEME competitions 40% Burn 2.5% Team wallet 5% Airdrop 📄 Here’s our Contract address : 0xa0B97E2C7c320bD61A325A159296924b741F4C56 What's the plan after launching? Its all about MARKETING and getting Listed on CMC & CG and the DEXTOOLS trending. We got that sorted, expecting to get listed on the same day on CG & CMC or not more than 48 hours alongside with DEXTOOL trending. 🍱 For more info please visit the socials 🍱 🌍 Website: elegantdoge.net 🕊 Twitter: https://twitter.com/ElegantDogeBSC PancakeSwap : https://exchange.pancakeswap.finance/#/swap?outputCurrency=0xa0B97E2C7c320bD61A325A159296924b741F4C56 LP Locked : https://deeplock.io/lock/0x13DFBe2E0c11BfCE6aE5b713922c341aE25fbA86 Ownership Renounced : https://bscscan.com/token/0xa0B97E2C7c320bD61A325A159296924b741F4C56
submitted by ShruchWroiags to cryptostreetbets [link] [comments]


2021.12.08 03:23 anax44 ULTIMATE JAMAICAN STREET FOOD COOKOUT WITH DREW BINSKY!! BLUE MOUNTAINS JAMAICA

ULTIMATE JAMAICAN STREET FOOD COOKOUT WITH DREW BINSKY!! BLUE MOUNTAINS JAMAICA submitted by anax44 to CaribbeanFood [link] [comments]


2021.12.08 03:23 cantdo_anything Italian shop for gifts?

I'm looking for Christmas gifts for my boyfriend's grandparents. They're from Italy and are retired. They don't have many hobbies but I was hoping to find an Italian imported goods type shop where I can browse at. I've never explored little Italy in Toronto so not sure where to start looking. Any ideas or location suggestions would be greatly appreciated! TIA!
submitted by cantdo_anything to askTO [link] [comments]


2021.12.08 03:23 hmoooody “Regrets” A Chain on My Throat

Nothing punches a broken-hearted harder than a trip down the memory lane of regrets. It can be something big, something like you being an avoidant and not expressing your love and commitment to the person for whom your heart beats, but you can’t say it with words. But it can also be something as small as not washing the dishes that one night which pissed her off. That one time you didn’t kiss her good night, that one time you didn’t go out with her when she asked you to come with her. That one time when you wanted to tell her “I appreciate you” but you didn’t. That one time when you could have not acted like a jerk for no reason. That one time when you wanted to tell her “I Love You” but you didn’t. Nothing suffocates a broken-hearted harder than regrets about things you didn’t know at the moment when they were happening. The little annoying habits, the domination, the avoidance, the words you thought were ok but deep down it hurt her, the actions you thought were ok to do but deep down it hurt her. These regrets are the worst. You don’t know which one played the biggest role in breaking your heart. You can’t find the beginning, the middle nor the end of it. I know we only act the way we do, based on the knowledge we have at that moment but the pain you go through to gain this knowledge is rude. The awakening you get is rude, that’s why they say life is a series of rude awakenings. Oh I wish I knew about these habits, words, actions before they all become only one word. “Regret”! Before it didn’t matter if I worked on them or not because the one I wanted to improve it for, isn’t here anymore. I’ve probably turned in to a “regret” itself for her. Regrets make you hopeless. It kills all the hope for you to see that person ever again. Maybe it’s a good thing. Maybe it’s not that bad. Because why would you hope when hope is nothing more than delayed disappointment. Regrets! An infinite tunnel with no lights at the end of it.
submitted by hmoooody to ExNoContact [link] [comments]


2021.12.08 03:23 fille_de_brouillard Cacti are pretty cool 😎😎😎

submitted by fille_de_brouillard to teenagersbutpog [link] [comments]


2021.12.08 03:23 ShruchWroiags NEW moonshot launch in 2 days!!| I think that this meme coin can explode this weekend | Know it | 15 BNB in liquidity and Locked for 7 months

ElegantDoge $EDOGE This is an early project and an get x50 minimum. You need to know it this week. Here’s some information about the $EDOGE Token. Sale is on December 10th, 2021 14:00 UTC We are hosting our Fairlaunch on PancakeSwap V2 (PUBLIC SALE) Initial liquidity is 15BNB Max Buy: 0.6 BNB at start. Min Buy: Dont have Min Buy. Liquidity is locked for 12 Months. Sale Rate 1 BNB = 920.000.000.000 $EDOGE Our Tokenomics are: 50% Public Fairlaunch 2.5% NFT Creation and MEME competitions 40% Burn 2.5% Team wallet 5% Airdrop 📄 Here’s our Contract address : 0xa0B97E2C7c320bD61A325A159296924b741F4C56 What's the plan after launching? Its all about MARKETING and getting Listed on CMC & CG and the DEXTOOLS trending. We got that sorted, expecting to get listed on the same day on CG & CMC or not more than 48 hours alongside with DEXTOOL trending. 🍱 For more info please visit the socials 🍱 🌍 Website: elegantdoge.net 🕊 Twitter: https://twitter.com/ElegantDogeBSC PancakeSwap : https://exchange.pancakeswap.finance/#/swap?outputCurrency=0xa0B97E2C7c320bD61A325A159296924b741F4C56 LP Locked : https://deeplock.io/lock/0x13DFBe2E0c11BfCE6aE5b713922c341aE25fbA86 Ownership Renounced : https://bscscan.com/token/0xa0B97E2C7c320bD61A325A159296924b741F4C56
submitted by ShruchWroiags to CryptoMoonCoins [link] [comments]


2021.12.08 03:23 Mrnicksitdicksit Game longer

Game longer submitted by Mrnicksitdicksit to dogecoin [link] [comments]


2021.12.08 03:23 MosDefMoz 31 [M4F] work is slow, chats?

Work is slow tonight, would be nice to have someone new to chat with. Send me a message if you're interested in chatting.
submitted by MosDefMoz to snapchat [link] [comments]


2021.12.08 03:23 SportsFan-Bot The Cavs have now won the game in every game since the start of the season

With a win over the Lakers on Sunday night, they now have an 8-0 record in the regular season.
submitted by SportsFan-Bot to SubSimGPT2Interactive [link] [comments]


2021.12.08 03:23 ChillaVen $5 necklace at my favorite antique shop. I’m reasonably confident about the square beads but less so the oval ones.

$5 necklace at my favorite antique shop. I’m reasonably confident about the square beads but less so the oval ones. submitted by ChillaVen to uraniumglass [link] [comments]


2021.12.08 03:23 TheGreenAquaman No Documents Folder on Mac?

Just purchased '22 -- figured I'd jump back into the actual new installments of the franchise after obsessively playing '14 for many years. Played about 13 hours in the base game, then decided to install some custom leagues and such. When I went to the Documents folder on my Mac and went to look for '22, I found it simply wasn't there. '13, '14, and even '18 which I got as a gift and hardly played have their own folders, but no '22. Any tips on how I can actually modify the game without going this traditional direction?
submitted by TheGreenAquaman to footballmanagergames [link] [comments]


2021.12.08 03:23 Difficult-Shake7754 Migraines

Was free for an entire month. I did however tell myself that with a migraine I could turn to it if I’d exhausted caffeine, hydration, muscular adjustments, and medication. That happened twice recently and the 30 day chip doesn’t seem like it really fits anymore. I’ve since been to the doc and got a new rx with fewer side effects, but didn’t have it earlier. Ultimately the “day count” doesn’t officially matter, and I’m happy to know that two incidents outside of my “designated control” haven’t changed much, but it would be nicer if I’d have been straight and narrow this whole time. The times I did use it, I was sure to stop when it had got rid of the pain and not continued unless it had resumed. I’m hoping this will no longer be necessary with the new rx
submitted by Difficult-Shake7754 to leaves [link] [comments]


2021.12.08 03:23 Good-Gloves 50 USDC from Ledn when you deposit either 75 USDC or 0.0015 BTC

Ledn is a digital asset lending company in the same line of business as Nexo and Celsius. Ledn give you 50 USDC when you deposit either 75 USDC or 0.0015 BTC.
Ledn's give you interest on your deposits of Bitcoin (6.25%) or USDC (9.5%)
There is a fee 10 USDC to withdraw USDC while to withdraw Bitcoin you just pay the network fee. You can get around the 10 USDC fee by depositing $100 (minimum trade) of Bitcoin and swap your Bitcoin to USDC then swap your $150 USDC back to Bitcoin to withdraw. Gemini give you 10 free crypto withdrawals each month if you wanted to buy Bitcoin on Gemini.
[https://ledn.io/](https://ledn.io/) Non referral link
[Ledn referral terms](https://ledn.io/legal/en/referral-terms/)
Steps;

  1. Tap my [referral link](https://platform.ledn.io/join/75762d32abb9acfecd8cc5f46163dc2f) and verify your account (passport /drive lice /ID) (took one minute).
  2. Deposit 75 USDC or 0.0015 BTC and keep this in your account for 15 days.
Your bonus is paid after 15 days and you can then withdraw your deposit and bonus.
submitted by Good-Gloves to FreeCrypto [link] [comments]


2021.12.08 03:23 cjstout2050 First Time Seeing a 5v4 Quickplay

First Time Seeing a 5v4 Quickplay submitted by cjstout2050 to halo [link] [comments]


2021.12.08 03:23 NoAd7685 My first printed unit of Fodder for Turnip28

My first printed unit of Fodder for Turnip28 first unit of Fodder for the tabletop game Turnip28, I am just waiting on some arms to finish and then the filler and primer come out! I sculpted the teeth and 'eyes' in the hoods not the larger ones in the back.
Printed on my Mars pro using pretty default setting in lychee slicer, not the cleanest print but that kinda matches with the game's setting.

The Chatterers Fodder unit
submitted by NoAd7685 to PrintedMinis [link] [comments]


2021.12.08 03:23 Better_Teaching6697 🎄 Cute Santa | 1000x potential 🚀 | Just Launched | Experienced Team | 7% DOGE rewards 🎁 | Anti-Whale | Dont Miss out !!!

What is Cute Santa?

Cute Santa is a reward token. Every 60 minutes, DOGE dividends will be sent to your wallet, if you hold at least 200,000 tokens. You can also manually claim your dividends in the main contract. Also each transaction you make will automatically claim your dividends. The longer you hold the more you earn!
A max wallet of 3% and max transaction of 1% allows us to prevent big wallets and dumps. The initial liquidity will be locked for several months into the deepest of the deepest locks and will be below 5 BNB so this token has the chance to go absolutely parabolic!

Tokenomics:
1,000,000,000 Total supply
3% max wallet to prevent whales
1% max tx to prevent dumps

Tax 10% for buy & sell:
7% in DOGE reward
1% to locked liquidity pool
2***% to marketing and buyback***
Slippage is ~ 10-12%

Links:
Contract: 0x5164a75e86403867d9863104b69c7d69c942d9dd
Buy Now: https://pancakeswap.finance/swap?outputCurrency=0x5164a75e86403867d9863104b69c7d69c942d9dd
Liquidty locked for 3 years: https://deeplock.io/lock/0xed767bB6A369E536F6c4A9F05dBBC01d94a744c6
submitted by Better_Teaching6697 to ico [link] [comments]


2021.12.08 03:23 ShruchWroiags NEW moonshot launch in 2 days!!| I think that this meme coin can explode this weekend | Know it | 15 BNB in liquidity and Locked for 7 months

ElegantDoge $EDOGE This is an early project and an get x50 minimum. You need to know it this week. Here’s some information about the $EDOGE Token. Sale is on December 10th, 2021 14:00 UTC We are hosting our Fairlaunch on PancakeSwap V2 (PUBLIC SALE) Initial liquidity is 15BNB Max Buy: 0.6 BNB at start. Min Buy: Dont have Min Buy. Liquidity is locked for 12 Months. Sale Rate 1 BNB = 920.000.000.000 $EDOGE Our Tokenomics are: 50% Public Fairlaunch 2.5% NFT Creation and MEME competitions 40% Burn 2.5% Team wallet 5% Airdrop 📄 Here’s our Contract address : 0xa0B97E2C7c320bD61A325A159296924b741F4C56 What's the plan after launching? Its all about MARKETING and getting Listed on CMC & CG and the DEXTOOLS trending. We got that sorted, expecting to get listed on the same day on CG & CMC or not more than 48 hours alongside with DEXTOOL trending. 🍱 For more info please visit the socials 🍱 🌍 Website: elegantdoge.net 🕊 Twitter: https://twitter.com/ElegantDogeBSC PancakeSwap : https://exchange.pancakeswap.finance/#/swap?outputCurrency=0xa0B97E2C7c320bD61A325A159296924b741F4C56 LP Locked : https://deeplock.io/lock/0x13DFBe2E0c11BfCE6aE5b713922c341aE25fbA86 Ownership Renounced : https://bscscan.com/token/0xa0B97E2C7c320bD61A325A159296924b741F4C56
submitted by ShruchWroiags to ico [link] [comments]


2021.12.08 03:23 Mjiijm Who thinks we should boycott PSLV?

I have never seen one sign that Sprott cares one bit about its investors and shareholders. Seems more like a gold and silver hoardemanipulator. Thoughts??
submitted by Mjiijm to Wallstreetsilver [link] [comments]


2021.12.08 03:23 Mythril382 Empty Text Box

Does anyone have an empty dialog box? The ones the NPCs use but without the close or shop or anything like that button. And also no dialog. I want to use it for a video.
submitted by Mythril382 to Terraria [link] [comments]


2021.12.08 03:23 Tiffanys69toes @tiffanys_toes69

@tiffanys_toes69 submitted by Tiffanys69toes to Feetishh [link] [comments]


2021.12.08 03:23 cosmicreign26 FINALLY! took 5 years!!!!

FINALLY! took 5 years!!!! submitted by cosmicreign26 to pokemongobrag [link] [comments]


2021.12.08 03:23 The_Seikopath [6139 6002] I have an addiction ….

[6139 6002] I have an addiction …. submitted by The_Seikopath to Seiko [link] [comments]


2021.12.08 03:23 anv3d Starting a new 1.18 SMP to play with my friends! I found this awesome spawn! (seed in comments!)

Starting a new 1.18 SMP to play with my friends! I found this awesome spawn! (seed in comments!) submitted by anv3d to Minecraft [link] [comments]


http://chernomoretsfc.ru