You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
1.3 KiB
77 lines
1.3 KiB
function herman() {
|
|
int x1 := 0;
|
|
int x2 := 0;
|
|
int x3 := 0;
|
|
int x4 := 0;
|
|
int x5 := 0;
|
|
int x6 := 0;
|
|
int x7 := 0;
|
|
int oldx1 := 0;
|
|
int oldx2 := 0;
|
|
int oldx3 := 0;
|
|
int oldx4 := 0;
|
|
int oldx5 := 0;
|
|
int oldx6 := 0;
|
|
int oldx7 := 0;
|
|
|
|
{x1 := 0;} [] {x1 := 1;}
|
|
{x2 := 0;} [] {x2 := 1;}
|
|
{x3 := 0;} [] {x3 := 1;}
|
|
{x4 := 0;} [] {x4 := 1;}
|
|
{x5 := 0;} [] {x5 := 1;}
|
|
{x6 := 0;} [] {x6 := 1;}
|
|
{x7 := 0;} [] {x7 := 1;}
|
|
|
|
// finds a ring configuration with exactly one token in the ring.
|
|
while((x1 + x2 + x3 + x4 + x5 + x6 + x7) != 1) {
|
|
oldx1 := x1;
|
|
oldx2 := x2;
|
|
oldx3 := x3;
|
|
oldx4 := x4;
|
|
oldx5 := x5;
|
|
oldx6 := x6;
|
|
oldx7 := x7;
|
|
if(x1 = oldx7) {
|
|
{x1 := 0;} [0.5] {x1 := 1;}
|
|
} else {
|
|
x1 := oldx7;
|
|
}
|
|
oldx7 := 0;
|
|
if(x2 = oldx1) {
|
|
{x2 := 0;} [0.5] {x2 := 1;}
|
|
} else {
|
|
x2 := oldx1;
|
|
}
|
|
oldx1 := 0;
|
|
if(x3 = oldx2) {
|
|
{x3 := 0;} [0.5] {x3 := 1;}
|
|
} else {
|
|
x3 := oldx2;
|
|
}
|
|
oldx2 := 0;
|
|
if(x4 = oldx3) {
|
|
{x4 := 0;} [0.5] {x4 := 1;}
|
|
} else {
|
|
x4 := oldx3;
|
|
}
|
|
oldx3 := 0;
|
|
if(x5 = oldx4) {
|
|
{x5 := 0;} [0.5] {x5 := 1;}
|
|
} else {
|
|
x5 := oldx4;
|
|
}
|
|
oldx4 := 0;
|
|
if(x6 = oldx5) {
|
|
{x6 := 0;} [0.5] {x6 := 1;}
|
|
} else {
|
|
x6 := oldx5;
|
|
}
|
|
oldx5 := 0;
|
|
if(x7 = oldx6) {
|
|
{x7 := 0;} [0.5] {x7 := 1;}
|
|
} else {
|
|
x7 := oldx6;
|
|
}
|
|
oldx6 := 0;
|
|
}
|
|
}
|