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.

60 lines
1.2 KiB

  1. function coupon10() {
  2. int coup0 := 0;
  3. int coup1 := 0;
  4. int coup2 := 0;
  5. int coup3 := 0;
  6. int coup4 := 0;
  7. int coup5 := 0;
  8. int coup6 := 0;
  9. int coup7 := 0;
  10. int coup8 := 0;
  11. int coup9 := 0;
  12. int coup10 := 0;
  13. int draw1 := 0;
  14. int draw2 := 0;
  15. int draw3 := 0;
  16. int cost := 1;
  17. while (!(coup0 = 1) | !(coup1 = 1) | !(coup2 = 1) | !(coup3 = 1) | !(coup4 = 1) | !(coup5= 1) | !(coup6 = 1) | !(coup7 = 1) | !(coup8 = 1) | !(coup9 = 1) | !(coup10 = 1)) {
  18. draw1 := unif(0,10);
  19. draw2 := unif(0,10);
  20. draw3 := unif(0,10);
  21. cost := ceil(1.02 * cost);
  22. if(draw1 = 0 | draw2 = 0 | draw3 = 0) {
  23. coup0 := 1;
  24. }
  25. if(draw1 = 1 | draw2 = 1 | draw3 = 1) {
  26. coup1 := 1;
  27. }
  28. if(draw1 = 2 | draw2 = 2 | draw3 = 2) {
  29. coup2 := 1;
  30. }
  31. if (draw1 = 3 | draw2 = 3 | draw3 = 3) {
  32. coup3 := 1;
  33. }
  34. if (draw1 = 4 | draw2 = 4 | draw3 = 4) {
  35. coup4 := 1;
  36. }
  37. if (draw1 = 5 | draw2 = 5 | draw3 = 5) {
  38. coup5 := 1;
  39. }
  40. if (draw1 = 6 | draw2 = 6 | draw3 = 6) {
  41. coup6 := 1;
  42. }
  43. if (draw1 = 7 | draw2 = 7 | draw3 = 7) {
  44. coup7 := 1;
  45. }
  46. if (draw1 = 8 | draw2 = 8 | draw3 = 8) {
  47. coup8 := 1;
  48. }
  49. if (draw1 = 9 | draw2 = 9 | draw3 = 9) {
  50. coup9 := 1;
  51. }
  52. if (draw1 = 10 | draw2 = 10 | draw3 = 10) {
  53. coup10 := 1;
  54. }
  55. }
  56. }