Con 7 cilindri si imita il 7 segmenti degli schermi a cristalli liquidi.
Per evitare gli spazi negli angoli si possono aggiungere 6 sfere!

from vpython import *
#----------------------------------------------------------------------------------- Parametri
C = color.yellow # Colore dei cilindri
D = 1 # Dimensione, lunghezza dei cilindri
R = D/5 # Raggio dei cilindri
#----------------------------------------------------------------------------------- Tutto acceso!
SETTE_CILINDRI = [
cylinder(pos=vector(0,2*D,0), axis=vector(1,0,0), radius=R, color=C), # 0
cylinder(pos=vector(0, D,0), axis=vector(0,1,0), radius=R, color=C), # 1
cylinder(pos=vector(D, D,0), axis=vector(0,1,0), radius=R, color=C), # 2
cylinder(pos=vector(0, D,0), axis=vector(1,0,0), radius=R, color=C), # 3
cylinder(pos=vector(0, 0,0), axis=vector(0,1,0), radius=R, color=C), # 4
cylinder(pos=vector(D, 0,0), axis=vector(0,1,0), radius=R, color=C), # 5
cylinder(pos=vector(0, 0,0), axis=vector(1,0,0), radius=R, color=C) # 6
]
SEI_SFERE = [
sphere(pos=vector(0,2*D,0), radius=R, color=C), # 0
sphere(pos=vector(D,2*D,0), radius=R, color=C), # 1
sphere(pos=vector(0, D,0), radius=R, color=C), # 2
sphere(pos=vector(D, D,0), radius=R, color=C), # 3
sphere(pos=vector(0, 0,0), radius=R, color=C), # 4
sphere(pos=vector(D, 0,0), radius=R, color=C), # 5
]
#----------------------------------------------------------------------------------- Mappa
VALORI_CILINDRI = [
[True , True , True , False, True , True , True ], # 0
[False, False, True , False, False, True , False], # 1
[True , False, True , True , True , False, True ], # 2
[True , False, True , True , False, True , True ], # 3
[False, True , True , True , False, True , False], # 4
[True , True , False, True , False, True , True ], # 5
[False, True , False, True , True , True , True ], # 6
[True , False, True , False, False, True , False], # 7
[True , True , True , True , True , True , True ], # 8
[True , True , True , True , False, True , False] # 9
]
VALORI_SFERE = [
[True , True , False, False, True , True],
[False, True , False, False, False, True],
[True , True , True , True , True , True],
[True , True , True , False, True , True],
[True , True , True , False, False, True],
[True , True , True , True , True , True],
[True , False, True , True , True , True],
[True , True , False, False, False, True],
[True , True , False, False, True , True],
[True , True , True , False, False, True]
]
#-----------------------------------------------------------------------------------
def aggiorna_stato(valore):
for cilindro in range(7):
SETTE_CILINDRI[cilindro].visible = VALORI_CILINDRI[valore][cilindro]
for sfera in range(6):
SEI_SFERE[sfera].visible = VALORI_SFERE[valore][sfera]
#-----------------------------------------------------------------------------------
x = 0
while(True):
rate(1)
aggiorna_stato(x)
x += 1
if(x > 9):
x = 0