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.

30 lines
555 B

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