Un Simon en python en une petite centaine de lignes..
Testé sous Ubuntu et Windows 10.
Fonctionne aussi sur smartphone, en installant l'appli PyDroid (il faut enlever ligne 109 l'option font=('sans', 20, 'bold').
Le code n'est peut-être pas exemplaire pour les puristes en Python, mais fonctionnel si cela peut servir à certains.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
from tkinter import *
from tkinter.constants import *
import random
from tkinter import messagebox
"""
        Reproduire la séquence de couleurs proposée par le PC
        La vitesse de clignotement est paramétrable par
        l'intermédiaire de deux RadioButtons.
        Les couleurs sont numérotées de 0 à 3 dans le sens
        haut gauche à bas droite.
"""
def Ombre(ButClic):
    listeB[ButClic].configure(background=listeCoul[ButClic])  
 
def JeuxHM(BoutClic):
    global compte
    global compteJH
    global flag
    global listeClic
    if compteJH <compte:               
                compteJH+=1
                fen.bell()
    if BoutClic!=listeClic[compteJH-1]: #dernier clic à comparer ds la liste faite par le PC
                messagebox.showinfo("PERDU",listeClic)
                b1.config(state='normal')
                compteJH=0 #remise à zéro et sortir de la fonction jeuHM
                compte=0
                boucle=0
                flag="jeuPC"
                listeClic[:]=[]
                message['text']=" En attente"
                return
    if compteJH==compte:      #dernier clic joueur ss erreur  donc passe la main à JeuxPC()  
                flag="jeuPC"      # je change le flag
                fen.title("SIMON  Score={}".format(compteJH))
                JeuxPC()
 
def JeuxPC():
    global compte
    global compteJH
    global flag
    global boucle
    global varChoix
    global TimerC
    if flag=="jeuPC": #premier tirage avant guirlande
        for nbBut in range(0,4):    # Boutons inactifs
                        listeB[nbBut].configure(state=DISABLED)
        if varChoix.get()=="Norm":
            TimerC=800
        else:
            TimerC=200
        #print(TimerC,flag)
        message['text']=" PC joue..."
        compte+=1   #compteur des jeux PC (0,1,2,3,4...)
        compteJH=0  #compteur des jeux Humain
        boucle=0 #guirlande à comparer au nombre de jeux PC
        valCoul=random.randint(0,3) # nouveau tirage
        listeClic.append(valCoul)  # je rajoute à listeClic
        #print(listeClic)
        flag="jeuHM" # prochain passage avec fen.after(1000, JeuxPC)=suite guirlande
    if boucle<compte:
        #print(boucle,compte,listeClic[boucle])
        listeB[listeClic[boucle]].configure(background=listeCoulOmb[listeClic[boucle]])
        fen.after(TimerC, lambda x=listeClic[boucle]: Ombre(x)) # clignotement du pavé
        boucle+=1
    else: # donc boucle=compte je passe la main après la guirlande aux évènements sur Button
        message['text']=" Humain joue..."
        for nbBut in range(0,4):    # Boutons actifs
                        listeB[nbBut].configure(state=NORMAL)
        return # sortie de JeuxPC et en attente évènement sur un Button (JeuxHM())
    fen.after(1000, JeuxPC)
 
fen = Tk()
fen.title("SIMON")
listeCoul=['red','blue','green','yellow'] #couleurs de base
listeCoulOmb=['#d93199','#0090d9','#00d9c4','#f4d9a6'] # couleur de clignotement
listeClic=[]
listeB=[] # liste des 4 boutons cliquables (référence objet tkinter)
htB=15
lgB=25
taille_grille=2
for y in range(taille_grille) :    # créatiob de 4 boutons cliquables
        for x in range(taille_grille) :
            b = Button(fen,
                       width=lgB,
                       height=htB,
                       background=listeCoul[(y*2)+(x+1)-1], 
                       activebackground=listeCoul[(y*2)+(x+1)-1],
                       command=lambda ButClic=(y*2)+(x): JeuxHM(ButClic))#de 0 à 3
            listeB.append(b)
            b.grid(row=y, column=x)
#print(listeB)
varChoix=StringVar()
boutNormal = Radiobutton(fen,
		 text = "Normal",
		 variable =varChoix,
		 value = "Norm"
                    )
boutNormal.select()
boutHauteur = Radiobutton(fen,
		 text = "Rapide",
		 variable =varChoix,
		 value = "Rap"
                 )
boutNormal.grid(row=4,column =0,sticky="NSWE")
boutHauteur.grid(row=4,column =1,sticky="NSWE")
b1=Button(fen,      text="Jouer",command=JeuxPC)
b1.grid(row=5,column=0,columnspan=2,sticky="NSWE")
message = Label(fen,font=('sans', 20, 'bold'),text="En attente")
message.grid(row=3,column=0,columnspan=2,sticky="NSWE")
compte=0
flag="jeuPC"
fen.mainloop()