
byte A[9];
byte i,j;

process P {
state start, run;
init start;
trans
 start -> start { guard i<9; effect A[i]=i, i = i+1; },
 start -> run {guard i==9; effect i=0, j=0;},
 run -> run {guard j>0; effect A[i*3+j] = A[i*3+j-1], A[i*3+j-1] =0, j = j-1;},
 run -> run {guard j<2; effect A[i*3+j] = A[i*3+j+1], A[i*3+j+1] =0, j = j+1;},
 run -> run {guard i>0; effect A[i*3+j] = A[(i-1)*3+j], A[(i-1)*3+j] =0, i = i-1;},
 run -> run {guard i<2; effect A[i*3+j] = A[(i+1)*3+j], A[(i+1)*3+j] =0, i = i+1;};
}

system async;