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

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