Path Finding - 8-Puzzle Problem

Hash and BFS

2023/01/27 · Allen Wu

UVa 1600 Patrol Robot

AI Translated from Chinese Problem: Luogu UVa439 Problem Statement Input an m*n matrix representing a map, where 1 represents obstacles and 0 represents free space. The robot needs to move from (1,1) to (m,n) on the m*n map. Each move can go one cell in one of the four directions (up, down, left, right), and can consecutively cross at most k obstacles. Data satisfies 1 <= m, n <= 20, 0 <= k <= 20. ...

2023/01/11 · Allen Wu

UVa 439 Knight Moves

AI Translated from Chinese First time writing a solution ~ Simple, but got stuck for a while. Finally realized I forgot to zero the array XD Problem: Luogu UVa439 Problem Statement Input two coordinates on an 8×8 chessboard (start and end points. Column: ah, Row: 18). Find the minimum number of moves a Knight needs to get from start to end. Analysis Typical BFS shortest path problem. 2D array id[10][10] stores the step count after taking one more step from this cell. Queues qx, qy store coordinates. ...

2023/01/09 · Allen Wu