Based on the given values, it looks like your H is not admissible. Since it takes 10 to get from (2,3) to (2,2), I assume it should take 10 to get from (2,2) to (3,1), but your H says it takes 20 (i.e. you overestimate).
One possible H is the direct distance to the target (either something like Manhattan distance or Euclidean).
At our first step, we explore all neighbours. Our G values will look like: (G
= green, R
= red)
14
10 10
14 R 14
10 10
G 14
Let's take H as something like Manhattan distance, where 14 is a diagonal jump and 10 is a move to a direct neighbour. This is actually be the perfect heuristic for this example, as it's exactly the same as the actual distance. This will be different once there are obstacles in the path.
Then we get H values as:
34
24 30
14 R 34
10 24
G 14
So our F values (= G + H) are:
48
34 40
28 R 48
20 34
G 28
Then you find the minimum, which is 20, explore all it's (unexplored) neighbours and find the minimum, which will be the goal in this case.
Note that it's a easy mistake to stop as soon as one of the neighbours is the target, rather than the node we are currently exploring. An admissible heuristic doesn't guarantee that we'll find the optimal path to the target if we do this.