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.
34 lines
659 B
34 lines
659 B
function crowds() {
|
|
int delivered := 0;
|
|
int lastSender := 0;
|
|
int remainingRuns := 100;
|
|
int observeSender := 0;
|
|
int observeOther := 0;
|
|
|
|
while(remainingRuns > 0) {
|
|
while(delivered = 0) {
|
|
{
|
|
if(lastSender = 0) {
|
|
observeSender := observeSender + 1;
|
|
} else {
|
|
observeOther := observeOther + 1;
|
|
}
|
|
lastSender := 0;
|
|
delivered := 1;
|
|
} [0.091] {
|
|
{
|
|
{ lastSender:=0; } [1/100] { lastSender := 1; }
|
|
}
|
|
[0.8]
|
|
{
|
|
lastSender := 0;
|
|
// When not forwarding, the message is delivered here.
|
|
delivered := 1;
|
|
}
|
|
}
|
|
}
|
|
delivered := 0;
|
|
// Set up new run.
|
|
remainingRuns := remainingRuns - 1;
|
|
}
|
|
}
|