(*states[f_List, r_List, output_:{}]:*)
states[{}, r_List, output_]:=Return[output];
states[f_List, r_List, output_:{}] := Module[{a =8, b = 5, c =3, r1, f1,p,x,y,z,graph={}, ou},
r1=r; f1=f;

x = f1[[1,1]]; y = f1[[1, 2]]; z = f1[[1,3]];

If[x>0, 
If[x> b-y,
p={x+y-b, b, z };
If[MemberQ[r1, p]=== False, 
AppendTo[r1, p]; AppendTo[f1, p];
AppendTo[graph, v[{x,y,z},p]]
],(* Else*)
p={0, x+y, z};
If[MemberQ[r1, p]=== False, 
AppendTo[r1, p];AppendTo[f1, p];
AppendTo[graph, v[{x,y,z},p]]
];
];
];

If[x>0, 
If[x> c-z,
p={x+z-c, y, c};
If[MemberQ[r1, p]=== False, 
AppendTo[r1, p];AppendTo[f1, p];
AppendTo[graph, v[{x,y,z},p]]
], (*Else*)
p={0, y, x+z};
If[MemberQ[r1, p]=== False, 
AppendTo[r1, p];AppendTo[f1, p];
AppendTo[graph, v[{x,y,z},p]]
];
]
];

(*Changing y*)
If[y>0, 
If[y> a-x,
If[MemberQ[r1, p]=== False, 
AppendTo[r1, p];AppendTo[f1, p];
AppendTo[graph, v[{x,y,z},p]]
],(* Else*)
p={x+y, 0, z};
If[MemberQ[r1, p]=== False, 
AppendTo[r1, p];AppendTo[f1, p];
AppendTo[graph, v[{x,y,z},p]]
];
]
];
If[y>0, 
If[y> c-z,
p={x, y+z-c, c};
If[MemberQ[r1, p]=== False, 
AppendTo[r1, p];AppendTo[f1, p];
AppendTo[graph, v[{x,y,z},p]]
],(* Else*)
p={x, 0, y+z};
If[MemberQ[r1, p]=== False, 
AppendTo[r1, p];AppendTo[f1, p];
AppendTo[graph, v[{x,y,z},p]]
];
]
];

(*Changing z*)
If[z>0, 
If[z> a-x,
p={ a,y, z+x-a};
If[MemberQ[r1, p]=== False, 
AppendTo[r1, p];AppendTo[f1, p];
AppendTo[graph, v[{x,y,z},p]]
], (*Else*)
p={x+z, y, 0};
If[MemberQ[r1, p]=== False, 
AppendTo[r1, p];AppendTo[f1, p];
AppendTo[graph, v[{x,y,z},p]]
];
]
];

If[z>0, 
If[z> b-y,
p={x, b,y+z-b};
If[MemberQ[r1, p]=== False, 
AppendTo[r1, p];AppendTo[f1, p];
AppendTo[graph, v[{x,y,z},p]]
], (*Else*)
p={x,y+z, 0};
If[MemberQ[r1, p]=== False, 
AppendTo[r1, p];AppendTo[f1, p];
AppendTo[graph, v[{x,y,z},p]]
];
]
];
ou = Union[output,graph];
 states[Delete[f1, 1], r1,ou]
]

st = states[{{8,0,0}}, {{8,0,0}},{}]/.v[{i_,j_,k_}, {m_,n_,s_}]:> {i,j,k}-> {m,n,s};
GraphPlot[st,VertexLabeling->True,MultiedgeStyle->0.2,DirectedEdges->True]

Graph[st,VertexLabels->"Name",ImageSize->450]