Monty Hall problem: Difference between revisions
m
→{{header|True BASIC}}
Not a robot (talk | contribs) (Add SETL) |
|||
(2 intermediate revisions by one other user not shown) | |||
Line 924:
==={{header|True BASIC}}===
<syntaxhighlight lang="
DIM puertas(3)
LET numTiradas = 1000000
FOR i =
LET pta_coche = INT(RND * 3) + 1
LET puertas(pta_coche) = 1
LET pta_elegida = INT(RND * 3) + 1
LET pta_montys =
LOOP WHILE puertas(pta_montys) = 1 OR pta_montys = pta_elegida
IF puertas(pta_elegida) = 1 THEN
ELSE
▲ DO
▲ LET pta_montys = INT(RND * 3) + 1
END IF
LET puertas(pta_coche) = 0
▲ IF pta_coche = pta_elegida THEN LET permanece = permanece + 1
NEXT i
PRINT "Cambiar gana el"; permanece / numTiradas * 100; "% de las veces."
PRINT "Mantenerse gana el"; cambia / numTiradas * 100; "% de las veces."
END</syntaxhighlight>▼
▲</syntaxhighlight>
==={{header|Yabasic}}===
Line 3,065:
(0.33241,0.66759)
</pre>
=={{header|K}}==
<syntaxhighlight lang="k">
montyhall:{t:,/ 1_ x {`prng@`t[];ch:1?3;pr:1?3;sw:1?2;$[sw;a:ch=pr;a:~(ch=pr)];a}\0N;("KEEP %";(+/t)%x;"SWAP %";(+/~t)%x)}
montyhall 100000
</syntaxhighlight>
=={{header|Kotlin}}==
|