Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How were you storing direction? Was it a symbol for one of NORTH, EAST, SOUTH, WEST, or a symbol for one of FORWARD, LEFT, RIGHT, or a pair of values for row direction and column direction (i.e. +1, 0 or -1, 0 or 0, +1, or 0, -1)?


A tuple vector with row and column offset, your third option here, which happen to have symbol names of N, S, E, and W.


Thanks for replying. Maybe I just have a dumb bug in my logic and should take another crack at it.


I know I had issues keeping track of how many steps I’d taken, but making sure I was generating a good set of neighbours helped with that.

Otherwise it was just making sure I got the rules right, like all AoC problems, and testing different cases to make sure my solution did the right thing.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: