HTML and CSS Reference
In-Depth Information
A* Applied to a Larger Tile Map
TodemonstrateA*pathfindinginamorereal-worldway,wemustfirstcreateanewtilemap.
For our next example, we are going to create a more maze-like structure that still uses just the
first two tile types.
The following code example shows the changes to the
Example 8-13
tile map for
have not provided the full code listing for this example, just the changes needed to turn
Example 8-13
into
Example 8-14
:
//Example 8-14 changes to Example 8-13 to make a larger tile map
var
var
mapRows
=
15
;
var
var
mapCols
=
15
;
var
var
tileMap
=
[
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
]
,[
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
]
,[
0
,
1
,
0
,
1
,
0
,
0
,
1
,
0
,
1
,
0
,
0
,
1
,
0
,
1
,
0
]
,[
0
,
1
,
0
,
1
,
0
,
0
,
1
,
0
,
1
,
0
,
0
,
1
,
0
,
1
,
0
]
,[
0
,
1
,
0
,
1
,
0
,
0
,
1
,
1
,
1
,
0
,
0
,
1
,
0
,
1
,
0
]
,[
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
]
,[
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
]
,[
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
]
,[
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
]
,[
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
0
]
,[
0
,
1
,
0
,
1
,
0
,
0
,
1
,
1
,
1
,
0
,
0
,
1
,
0
,
1
,
0
]
,[
0
,
1
,
0
,
1
,
0
,
0
,
1
,
0
,
1
,
0
,
0
,
1
,
0
,
1
,
0
]
,[
0
,
1
,
0
,
1
,
0
,
0
,
1
,
0
,
1
,
0
,
0
,
1
,
0
,
1
,
0
]
,[
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
]
,[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
]
];
Ifwe create atile map like the above, it will result inamap that looks like
Figure 8-13
,which
shows the output from the new, larger tile map that will be generated from this data.