How does the Alpha Zero's move encoding work?
Let's do the code, so all the details are down.
Encoding dictionary:
codes, i = {}, 0
for nSquares in range(1,8):
    for direction in [&quot;N&quot;, &quot;NE&quot;, &quot;E&quot;, &quot;SE&quot;, &quot;S&quot;, &quot;SW&quot;, &quot;W&quot;, &quot;NW&quot;]:
        codes[(nSquares,direction)] = i
        i += 1

You'll see that the codes dictionary will have 56 entries in it for each (nSquares,direction) pair.
The knight moves we'll encode as the long &quot;two&quot;-cell edge move first and the short &quot;one&quot;-cell edge second:
for two in [&quot;N&quot;,&quot;S&quot;]:
    for one in [&quot;E&quot;,&quot;W&quot;]:
        codes[(&quot;knight&quot;, two, one)] , i = i , i + 1
for two in [&quot;E&quot;,&quot;W&quot;]:
    for one in [&quot;N&quot;,&quot;S&quot;]:
        codes[(&quot;knight&quot;, two, one)] , i = i , i + 1

Now we should have 64 codes. As I understand, the final 9 moves are when a pawn reaches the final rank and chosen to be underpromoted. It can reach teh final rank either by moving N, or by capturing NE, NW. Underpromotion is possible to three pieces. Writing the code:
for move in [&quot;N&quot;,&quot;NW&quot;,&quot;NE&quot;]:
    for promote_to in [&quot;Rook&quot;,&quot;Knight&quot;,&quot;Bishop&quot;]:
        codes[(&quot;underpromotion&quot;, move, promote_to)] , i = i , i + 1

We get 73 codes as described.
Policy
The distribution over actions is a (8,8,73) tensor (it is not formally a &quot;policy&quot;, since policy should also depend on state, but lets cut this corner for this discussion):
policy = np.zeros((8,8,73))

Let's also do codes for columns for convenience:
columns = { k:v for v,k in enumerate(&quot;abcdefgh&quot;)}


How would one numerically represent the move 1. e4

The first two dimensions choose the figure you are moving. So, that'd be e2 pawn. And we move north 'N' by 2 cells.
So, we put 1 into the tensor at the appropriate indices. Note that you have to subtract 1 from the row index, to make it zero-based.
e4policy = np.zeros((8,8,73))
e4policy[ columns['e'] , 2 - 1 , codes[(2 , &quot;N&quot;)]] = 1


How would one numerically represent the move 1. NF3

The first two dimensions choose the figure you are moving. So, that'd be g1 knight. And we perform north-west N,W knight jump.
NF3policy = np.zeros((8,8,73))
NF3policy[ columns['g'] , 1 - 1 , codes[(&quot;knight&quot;, 'N' , 'W')]] = 1

Generally, the policy is a probability distribution over all possible moves, so the policy tensor would have several non-zero probability values in it. For example an opening policy that does 1.e4 or 1.Nf3 with 50/50 probability would be:
openingPolicy = (e4policy + NF3policy) / 2 

Hope this clears things up.