package astar0 var ( Direction4 = [][]int32{ {0, -1}, // 上 {-1, 0}, // 左 {1, 0}, // 右 {0, 1}, // 下 } Direction6Left = [][]int32{ {0, -1}, // 上(优先) {0, 1}, // 下(优先) {1, 0}, // 右(优先) {-1, 0}, // 左(优先) {-1, -1}, // 左上 {-1, 1}, // 左下 } Direction6Right = [][]int32{ {0, -1}, // 上(优先) {0, 1}, // 下(优先) {1, 0}, // 右(优先) {-1, 0}, // 左(优先) {1, -1}, // 右上 {1, 1}, // 右下 } // Column Staggered Grid (Even-q) // y 为偶数列 (Even X) (e.g. 58) -> Shifted DOWN (+0.5) // Neighbors: 4(Up), 1(Down), 5(LU), 6(LD), 3(RU), 2(RD) // Deltas from (x,y): // Up: {0, -1} // Down: {0, 1} // Left (LU): {-1, 0} // Left-Down (LD): {-1, 1} // Right (RU): {1, 0} // Right-Down (RD): {1, 1} Direction6EvenX = [][]int32{ {0, -1}, // Up {0, 1}, // Down {-1, 0}, // Left-Up {-1, 1}, // Left-Down {1, 0}, // Right-Up {1, 1}, // Right-Down } // Odd X columns (e.g. 57, 59) -> Shifted UP relative to Even // Neighbors relative to Odd center: // Up: {0, -1} // Down: {0, 1} // Left-Up (Top-Left): {-1, -1} // Left-Down (Bot-Left): {-1, 0} // Right-Up (Top-Right): {1, -1} // Right-Down (Bot-Right): {1, 0} Direction6OddX = [][]int32{ {0, -1}, // Up {0, 1}, // Down {-1, -1}, // Left-Up {-1, 0}, // Left-Down {1, -1}, // Right-Up {1, 0}, // Right-Down } Direction8 = [][]int32{ {0, -1}, // 上 {1, -1}, // 右上 {-1, 0}, // 左 {-1, -1}, // 左上 {1, 0}, // 右 {1, 1}, // 右下 {0, 1}, // 下 {-1, 1}, // 左下 } ) func Direction4Func(_ *Node) [][]int32 { return Direction4 } func Direction6Func(node *Node) [][]int32 { if node.x%2 == 0 { return Direction6Left } return Direction6Right } // Direction6ColFunc implements Column Stagger logic func Direction6ColFunc(node *Node) [][]int32 { if node.x%2 == 0 { return Direction6EvenX } return Direction6OddX } func Direction8Func(_ *Node) [][]int32 { return Direction8 }