You are welcome.
With FullForm[B
] you can see that B is in fact:
List[List[List[1,2,3],0],List[List[1,3,1],1],List[List[13,15,0],2],List[List[0,0,0],3]]
If you replace the List heads shown in bold with Rule you end up with
List[Rule[List[1,2,3],0],Rule[List[1,3,1],1],Rule[List[13,15,0],2],Rule[List[0,0,0],3]]
Which is the replacement rule that you need:
{{1, 2, 3} -> 0, {1, 3, 1} -> 1, {13, 15, 0} -> 2, {0, 0, 0} -> 3}
This operation can be done with Apply[Rule, B, {1}]
. This head replacing operation is so common that there is a shortcut for it: Rule@@@B
Then you just apply the replacement rule with /.