PY
py
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
'''Q&A'''
'''This is SHORT version of a simple picture of a game tree presented by a code 't'. '''
T = "0000110001100111100001100000100111100010010011111000110011101111110000000011001111000011000010110001111001111000110001100111110001100111001111100011000110011111"
T='0'+str(T)+'1'
def nLevel(T, c):
c+=2
while len(T)>=4:
for i in range(1,len(T),2):
T2=T[1:i]
if (T2.count('0')==T2.count('1')):
if len(T2)!=0:
print(len(T2))
print(c*' '+str(T2))
pT=T[len(T2):]
if T2.count('1')>0:
break
nLevel(T2, c)
T=pT
c = 0
if (T.count('0')==T.count('1')):
nLevel(T, c)
#Compare with this
'''
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run