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.
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
Post a Comment