Bonjour,

Nous avons besoins d'aide pour faire notre jeu du "Qui est ce" sous Python.

Nous avons realiser déjà ces queqlue lignes de code, mais nous ne savons pas par ou commencer ensuite. Nous voulons que l'ordinateur choisisse au hazard parmis 24 personnges ( qui seront des photos de personnes). Ensuite nous devons deviner le personnage en cliquant sur des questions placer dans un cadre ou un menu deroulant. L'ordinateur repond par oui ou non et supprime les images des personnes éliminés.

Nous voudrions juste avoir un peu d'aide pour comprendre les etapes a faires, par ou commancé et ce qui ne va pas dans notre programme.

merci.

Code python : 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
from tkinter import*
from random import*
 
#les variable
#sex
s1='fille'
s2='garcon'
#Peau
p1='blanche'
p2='noire'
#Yeux
y1='marron'
y2='vert'
y3='bleu'
#cheveux
g1='long'
g2='court'
c1='noir'
c2='chatain'
c3='blond'
#lunette
l1='oui'
l2='non'
#Chapeau
h1='oui'
h2='non'
 
#Personnage
#fille
 
personne1=[s1,p2,y1,g1,c1,l2,h1,"A"]
personne2=[s1,p1,y2,g2,c3,l1,h2,'B']
personne3=[s1,p2,y2,g2,c2,l2,h2,'C']
personne4=[s1,p1,y3,g1,c1,l1,h1,"D"]
personne5=[s1,p2,y2,g1,c1,l1,h2,'E']
personne6=[s1,p1,y3,g2,c3,l2,h2,"F"]
personne7=[s1,p2,y1,g2,c1,l1,h2,'G']
personne8=[s1,p1,y3,g2,c3,l2,h1,'H']
personne9=[s1,p2,y2,g1,c2,l2,h1,'I']
personne10=[s1,p1,y2,g1,c1,l1,h2,'J']
personne11=[s1,p2,y1,g1,c2,l1,h1,'K']
personne12=[s1,p1,y2,g2,c1,l1,h2,'L']
 
 
#garcon
personne13=[s2,p1,y1,g2,c3,l2,h2,'M']
personne14=[s2,p1,y1,g1,c2,l1,h1,'N']
personne15=[s2,p1,y2,g2,c2,l2,h1,'O']
personne16=[s2,p1,y2,g1,c1,l2,h2,'P']
personne17=[s2,p1,y3,g2,c3,l2,h2,'Q']
personne18=[s2,p1,y3,g2,c3,l1,h2,'R']
personne19=[s2,p2,y1,g2,c1,l2,h2,'S']
personne20=[s2,p2,y1,g1,c2,l2,h2,'T']
personne21=[s2,p2,y1,g1,c1,l1,h2,'U']
personne22=[s2,p2,y1,g2,c3,l2,h2,'V']
personne23=[s2,p2,y2,g2,c2,l2,h2,'W']
personne24=[s2,p2,y2,g2,c1,l2,h1,'X']
 
#Le personnage choisit
x=[personne1,personne2,personne3,personne4,personne5,personne6,personne7,personne8,personne9,personne10,personne11,personne12,personne13,personne14,personne15,personne16,personne17,personne18,personne19,personne20,personne21,personne22,personne23,personne24]
 
#Les Definitions :
 
def change():
    fenetre.geometry("800x500")
    boutonstart.place_forget()
    texte.place_forget()
 
def fille():
    if x.sex==s1:
        reponse.configure(text="oui")
    elif x.sex==s2:
        reponse.configure(text="non")
 
def garcon():
    if x.sex==s1:
        reponse.configure(text="non")
    elif x.sex==s2:
        reponse.configure(text="oui")
 
def blanche():
    if x.peau==p1:
        reponse.configure(text="oui")
    elif x.peau==p2:
        reponse.configure(text="non")
 
def noire():
    if x.peau==p1:
        reponse.configure(text="non")
    elif x.peau==p2:
        reponse.configure(text="oui")
 
 
def marron():
    if x.yeux==y1:
        reponse.configure(text="oui")
    elif x.yeux==y2 or x.yeux==y3:
        reponse.configure(text="non")
 
def vert():
    if x.yeux==y2:
        reponse.configure(text="oui")
    elif x.yeux==y1 or x.yeux==y3:
        reponse.configure(text="non")
 
def bleu():
    if x.yeux==y3:
        reponse.configure(text="oui")
    elif x.yeux==y1 or x.yeux==y2:
        reponse.configure(text="non")
 
 
def noir():
    if x.cheveux==c1:
        reponse.configure(text="oui")
    elif x.cheveux==c2 or x.yeux==c3:
        reponse.configure(text="non")
 
def chatain():
    if x.cheveux==c2:
        reponse.configure(text="oui")
    elif x.cheveux==c1 or x.yeux==c3:
        reponse.configure(text="non")
 
def blond():
    if x.cheveux==c3:
        reponse.configure(text="oui")
    elif x.cheveux==c1 or x.yeux==c2:
        reponse.configure(text="non")
 
def long():
    if x.grandeur==g1:
        reponse.configure(text="oui")
    elif x.grandeur==g2:
        reponse.configure(text="non")
 
def court():
    if x.grandeur==g2:
        reponse.configure(text="oui")
    elif x.grandeur==g1:
        reponse.configure(text="non")
 
 
def lunette():
    if x.lun==l1:
        reponse.configure(text="oui")
    elif x.lun==l2:
        reponse.configure(text="non")
 
def chapeau():
    if x.chap==h1:
        reponse.configure(text="oui")
    elif x.chap==h2:
        reponse.configure(text="non")
 
 
fenetre=Tk()
fenetre.title('Jeu : Qui est ce ? ')
fenetre.geometry("800x500")
boutonstart=Button (fenetre,text="Jouer", width=20,bg='red', fg='white', command=change)
boutonstart.place(x=300, y=250)
texte=Label(fenetre, text="Le Jeu du 'Qui es ce ?'",fg='red')
texte.config(font=('times',30,'bold'))
texte.place(x=150, y=50)
 
 
choix=randrange(0,23)
print('cest',x[0][7])
 
 
fenetre.mainloop()