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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

android - How to create dynamically Fragment pager adapter -

1111. appearing after print sequence - php -