java - How to find path trough blocks in a grid -


i've got grid 9x9 squares. squares written in array of integer. every integer represents 1 block. integer provides enough bits x,y positions, if block accessible , other data. have problem: effective way boolean value, if can center of grid random point. example provide x , y positions block want go, , method return boolean value, if there way through accessible blocks. made simple picture this. answers.can blue green trough white

what you're describing here well-known problem in computer science called pathfinding , not trivial solve efficiently.

however, there several algorithms solve this, a* , dijkstra, way go large, complicated maps.

if of problems small , simple posted example, try work simpler solution, brute force graph search, (as suggested codor).


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -