-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path3door3.py
More file actions
executable file
·40 lines (30 loc) · 763 Bytes
/
3door3.py
File metadata and controls
executable file
·40 lines (30 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# FileName: 3door3.py
#
# Description:
#
# Version: 1.0
# Created: 2018-07-03 15:47:44
# Last Modified: 2019-09-03 11:02:44
# Revision: none
# Compiler: gcc
#
# Author: zt ()
# Organization:
import numpy.random as rd
w_doors = rd.randint(0, 3, 1000)
i_cnts = 0
c_cnts = 0
for w_door in w_doors:
f_try = rd.randint(0, 3)
remain_c = [i for i in range(0, 3) if i != f_try]
wrong_c = [i for i in range(0, 3) if i != w_door]
if f_try in wrong_c:
wrong_c.remove(f_try)
remain_c.remove(rd.choice(wrong_c))
if f_try == w_door:
i_cnts += 1
if remain_c[0] == w_door:
c_cnts += 1
print("i=", i_cnts, "c=", c_cnts)