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.

38 lines
743 B

  1. function coupon5() {
  2. int coup0 := 0;
  3. int coup1 := 0;
  4. int coup2 := 0;
  5. int coup3 := 0;
  6. int coup4 := 0;
  7. int draw1 := 0;
  8. int draw2 := 0;
  9. int draw3 := 0;
  10. int numberDraws := 0;
  11. while (!(coup0 = 1) | !(coup1 = 1) | !(coup2 = 1) | !(coup3 = 1) | !(coup4 = 1)) {
  12. draw1 := unif(0,4);
  13. draw2 := unif(0,4);
  14. draw3 := unif(0,4);
  15. numberDraws := numberDraws + 1;
  16. observe (draw1 != draw2 & draw1 != draw3 & draw2 != draw3);
  17. if(draw1 = 0 | draw2 = 0 | draw3 = 0) {
  18. coup0 := 1;
  19. }
  20. if(draw1 = 1 | draw2 = 1 | draw3 = 1) {
  21. coup1 := 1;
  22. }
  23. if(draw1 = 2 | draw2 = 2 | draw3 = 2) {
  24. coup2 := 1;
  25. }
  26. if (draw1 = 3 | draw2 = 3 | draw3 = 3) {
  27. coup3 := 1;
  28. }
  29. if (draw1 = 4 | draw2 = 4 | draw3 = 4) {
  30. coup4 := 1;
  31. }
  32. }
  33. }