• Content count

  • Joined

  • Last visited

Community Reputation

198 Neutral

About Greenhouse

  • Rank
  1. Sounds like you want a flood fill algorithm that works across diagonals.   Yes, I need it to work in 8 directions.
  2. Hey everybody, I need an advice for an algorithm.   I'll try to describe what the situation is...   I have a structure that looks like this: A grid of cells having their coordinates and a value 'X' or 'O'.   I'm looking for an algorithm that could build me a path, array of cells that are having value of 'O' and one cell apart from each other (neighbor cells). buildPath: (x, y) -> array of cells So if I'll call it like buildPath( 2, 0 ) it will produce output something like so: [ (2,0); (3,1); (3,2); (3,3); (2,3); (1,3); (0,2); (0,1); (1,1) ]   It's not exactly what I'm looking for, but it will help me to start with.   Thanks.