Programming the game "Petit Bac" (ISN)
Furtifboy
Posted messages
1
Status
Member
-
critou -
critou -
Hello,
Currently in the final year of the S stream with an ISN option (having more than an amateur level), I have the project to create a program reproducing the game "Petit Bac". With my classmate, we started by creating the graphical interface, which is simplistic but suits us. However, we have been tackling the programming of the game for 2 weeks now, and we are stuck. The problem is that even after numerous searches, we still do not know how to implement it. We initially thought about creating a database to inform the user if the response they provided is correct or incorrect, but we cannot figure out how to detect if it is the correct answer given that the generated letters change each time.
We are therefore open to all your ideas, hoping that we will be able to solve this problem!
Thank you in advance. Name removed Moderation CCM
Below is the beginning of our programming:
Currently in the final year of the S stream with an ISN option (having more than an amateur level), I have the project to create a program reproducing the game "Petit Bac". With my classmate, we started by creating the graphical interface, which is simplistic but suits us. However, we have been tackling the programming of the game for 2 weeks now, and we are stuck. The problem is that even after numerous searches, we still do not know how to implement it. We initially thought about creating a database to inform the user if the response they provided is correct or incorrect, but we cannot figure out how to detect if it is the correct answer given that the generated letters change each time.
We are therefore open to all your ideas, hoping that we will be able to solve this problem!
Thank you in advance. Name removed Moderation CCM
Below is the beginning of our programming:
from tkinter import * from random import * alphabet = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'] i=randint(0,25) fen1 = Tk() fen1.geometry('1000x1000') letexte = 'The chosen letter is:' + alphabet[i] label = Label(fen1, text=letexte) label.grid() # creating widgets 'Label' and 'Entry' : txt1 = Label(fen1, text ='Animal :') txt2 = Label(fen1, text ='First name :') txt3 = Label(fen1, text ='City/Country :') txt4 = Label(fen1, text ='Sport :') txt5 = Label(fen1, text ='Job :') txt6 = Label(fen1, text ='Object : ') txt7 = Label(fen1, text ='Fruit/Vegetable :') entr1 = Entry(fen1) entr2 = Entry(fen1) entr3 = Entry(fen1) entr4 = Entry(fen1) entr5 = Entry(fen1) entr6 = Entry(fen1) entr7 = Entry(fen1) # creating a 'Canvas' widget containing a bitmap image : can1 = Canvas(fen1, width =600, height =350, bg ='white') photo = PhotoImage(file ='59410c12c3407.png') item = can1.create_image(270, 170, image =photo) txt1.grid(row =1, sticky =E) txt2.grid(row =2, sticky =E) txt3.grid(row =3, sticky =E) txt4.grid(row =4, sticky =E) txt5.grid(row =5, sticky =E) txt6.grid(row =6, sticky =E) txt7.grid(row =7, sticky =E) entr1.grid(row =1, column =2) entr2.grid(row =2, column =2) entr3.grid(row =3, column =2) entr4.grid(row =4, column =2) entr5.grid(row =5, column =2) entr6.grid(row =6, column =2) entr7.grid(row =7, column =2) can1.grid(row =1, column =7, rowspan =7, padx =10, pady =5) #stop button bouton=Button(fen1, text="STOP", width=20,height=5) bouton.configure(background="red", foreground="black") bouton.grid(row =8, column =2) bouton.grid() fen1.mainloop() | EDIT: Added code tags (syntax highlighting). Explanations available here: HERE Please keep this in mind in your future messages. |
1 answer
Hello.
If this game is indeed that one: https://fr.wikipedia.org/wiki/Jeu_du_baccalaur%C3%A9at
Then yes, you need to create a database, I'll leave it up to you to choose the type of files you want to adopt, plain text, csv, sqlite, xml, etc.
However:
Listing all the names of animals, first names (impossible), jobs, objects (impossible) seems to me a daunting task.
We should already settle for using simpler families, and ensure that what we validate is correct or not.
I don't see what the problem is, you should first find out how to retrieve the values entered in the Entry, how to use a command in Button.
If this game is indeed that one: https://fr.wikipedia.org/wiki/Jeu_du_baccalaur%C3%A9at
Then yes, you need to create a database, I'll leave it up to you to choose the type of files you want to adopt, plain text, csv, sqlite, xml, etc.
However:
txt1 = Label(fen1, text ='Animal :')
txt2 = Label(fen1, text ='First Name :')
txt3 = Label(fen1, text ='City/Country :')
txt4 = Label(fen1, text ='Sport :')
txt5 = Label(fen1, text ='Job :')
txt6 = Label(fen1, text ='Object : ')
txt7 = Label(fen1, text ='Fruit/Vegetable :')
Listing all the names of animals, first names (impossible), jobs, objects (impossible) seems to me a daunting task.
We should already settle for using simpler families, and ensure that what we validate is correct or not.
I don't see what the problem is, you should first find out how to retrieve the values entered in the Entry, how to use a command in Button.