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
658 B

  1. function crowds() {
  2. int delivered := 0;
  3. int lastSender := 0;
  4. int remainingRuns := 80;
  5. int observeSender := 0;
  6. int observeOther := 0;
  7. while(remainingRuns > 0) {
  8. while(delivered = 0) {
  9. {
  10. if(lastSender = 0) {
  11. observeSender := observeSender + 1;
  12. } else {
  13. observeOther := observeOther + 1;
  14. }
  15. lastSender := 0;
  16. delivered := 1;
  17. } [0.091] {
  18. {
  19. { lastSender:=0; } [1/100] { lastSender := 1; }
  20. }
  21. [0.8]
  22. {
  23. lastSender := 0;
  24. // When not forwarding, the message is delivered here.
  25. delivered := 1;
  26. }
  27. }
  28. }
  29. delivered := 0;
  30. // Set up new run.
  31. remainingRuns := remainingRuns - 1;
  32. }
  33. }