I created this function:
AddStone[board_Graph, v_, s : white | black | empty] :=
PropertyValue[{board, v}, VertexState] = s
This function should change the VertexState property of vertex v
in graph board
to one of white
, black
, or empty
. That's simple enough, right? Then I created a graph:
board = GridGraph[{5, 5}];
But then if I execute:
AddStone[board, 8, white]
I get an error:
"Set::setraw: Cannot assign to raw object PropertyValue[{ ... ,8},VertexState]=white."
where the "..." stands for an image of the graph board
, which I obviously need not draw here.
In the Documentation for PropertyValue
it is stated that one can set properties this way. In fact, the code
PropertyValue[{board, 4}, VertexState] = white
does work without issuing any messages.