diff --git a/TD1/correction/code/formes.py b/TD1/correction/code/formes.py deleted file mode 100755 index b010707d7ad2a5847c630babc695437e8419f47d..0000000000000000000000000000000000000000 --- a/TD1/correction/code/formes.py +++ /dev/null @@ -1,85 +0,0 @@ -class Forme: - def __init__(self, x, y): - self.__x = x - self.__y = y - - def get_pos(self): - return self.__x, self.__y - - def set_pos(self, x, y): - self.__x = x - self.__y = y - - def translation(self, dx, dy): - self.__x += dx - self.__y += dy - -class Rectangle(Forme): - def __init__(self, x, y, l, h): - Forme.__init__(self, x, y) - self.__l = l - self.__h = h - - def __str__(self): - return f"Rectangle d'origine {self.get_pos()} et de dimensions {self.__l}x{self.__h}" - - def get_dim(self): - return self.__l, self.__h - - def set_dim(self, l, h): - self.__l = l - self.__h = h - - def contient_point(self, x, y): - X, Y = self.get_pos() - return X <= x <= X + self.__l and \ - Y <= y <= Y + self.__h - - def redimension_par_points(self, x0, y0, x1, y1): - self.set_pos(min(x0, x1), min(y0, y1)) - self.__l = abs(x0 - x1) - self.__h = abs(y0 - y1) - -class Ellipse(Forme): - def __init__(self, x, y, rx, ry): - Forme.__init__(self, x, y) - self.__rx = rx - self.__ry = ry - - def __str__(self): - return f"Ellipse de centre {self.get_pos()} et de rayons {self.__rx}x{self.__ry}" - - def get_dim(self): - return self.__rx, self.__ry - - def set_dim(self, rx, ry): - self.__rx = rx - self.__ry = ry - - def contient_point(self, x, y): - X, Y = self.get_pos() - return ((x - X) / self.__rx) ** 2 + ((y - Y) / self.__ry) ** 2 <= 1 - - def redimension_par_points(self, x0, y0, x1, y1): - self.set_pos((x0 + x1) // 2, (y0 + y1) // 2) - self.__rx = abs(x0 - x1) / 2 - self.__ry = abs(y0 - y1) / 2 - -class Cercle(Ellipse): - def __init__(self, x, y, r): - Ellipse.__init__(self, x, y, r, r) - - def __str__(self): - return f"Cercle de centre {self.get_pos()} et de rayon {self.get_dim()}" - - def get_dim(self): - return Ellipse.get_dim(self)[0] - - def set_dim(self, r): - Ellipse.set_dim(self, r, r) - - def redimension_par_points(self, x0, y0, x1, y1): - r = min(abs(x0 - x1), abs(y0 - y1)) / 2 - self.set_dim(r) - self.set_pos(round(x0 + r if x1 > x0 else x0 - r), - round(y0 + r if y1 > y0 else y0 - r)) diff --git a/TD1/correction/code/formes_avec_dessin.py b/TD1/correction/code/formes_avec_dessin.py deleted file mode 100644 index b9717a60503a24884b4750dff75ba6d07c413c90..0000000000000000000000000000000000000000 --- a/TD1/correction/code/formes_avec_dessin.py +++ /dev/null @@ -1,125 +0,0 @@ -class Forme: - def __init__(self, x, y): - self.__x = x - self.__y = y - - self.__dessins = [] - - def get_pos(self): - return self.__x, self.__y - - def set_pos(self, x, y): - self.__x = x - self.__y = y - - def translation(self, dx, dy): - self.__x += dx - self.__y += dy - - def add_dessin(self,d): - self.__dessins.append(d) - - def del_dessin(self,d): - self.__dessins.remove(d) - - def print_dessins(self): - print("Liste des dessins de la forme : ") - for d in self.__dessins: - print(d.get_nom()) - -class Rectangle(Forme): - def __init__(self, x, y, l, h): - Forme.__init__(self, x, y) - self.__l = l - self.__h = h - - def __str__(self): - return f"Rectangle d'origine {self.get_pos()} et de dimensions {self.__l}x{self.__h}" - - def get_dim(self): - return self.__l, self.__h - - def set_dim(self, l, h): - self.__l = l - self.__h = h - - def contient_point(self, x, y): - X, Y = self.get_pos() - return X <= x <= X + self.__l and \ - Y <= y <= Y + self.__h - - def redimension_par_points(self, x0, y0, x1, y1): - self.set_pos(min(x0, x1), min(y0, y1)) - self.__l = abs(x0 - x1) - self.__h = abs(y0 - y1) - -class Ellipse(Forme): - def __init__(self, x, y, rx, ry): - Forme.__init__(self, x, y) - self.__rx = rx - self.__ry = ry - - def __str__(self): - return f"Ellipse de centre {self.get_pos()} et de rayons {self.__rx}x{self.__ry}" - - def get_dim(self): - return self.__rx, self.__ry - - def set_dim(self, rx, ry): - self.__rx = rx - self.__ry = ry - - def contient_point(self, x, y): - X, Y = self.get_pos() - return ((x - X) / self.__rx) ** 2 + ((y - Y) / self.__ry) ** 2 <= 1 - - def redimension_par_points(self, x0, y0, x1, y1): - self.set_pos((x0 + x1) // 2, (y0 + y1) // 2) - self.__rx = abs(x0 - x1) / 2 - self.__ry = abs(y0 - y1) / 2 - -class Cercle(Ellipse): - def __init__(self, x, y, r): - Ellipse.__init__(self, x, y, r, r) - - def __str__(self): - return f"Cercle de centre {self.get_pos()} et de rayon {self.get_dim()}" - - def get_dim(self): - return Ellipse.get_dim(self)[0] - - def set_dim(self, r): - Ellipse.set_dim(self, r, r) - - def redimension_par_points(self, x0, y0, x1, y1): - r = min(abs(x0 - x1), abs(y0 - y1)) / 2 - self.set_dim(r) - self.set_pos(round(x0 + r if x1 > x0 else x0 - r), - round(y0 + r if y1 > y0 else y0 - r)) - -class Dessin: - def __init__(self,n): - self.__nom = n - self.__formes = [] - - def get_nom(self): - return self.__nom - - def add_forme(self,f): - self.__formes.append(f) - f.add_dessin(self) - - def del_forme(self,position): - f = self.__formes.pop(position) - f.del_dessin(self) - - def print_formes(self): - print('--- Dessin ---') - for f in self.__formes: - print(f) - - def __str__(self): - s = '--- Dessin (avec print) ---' - for f in self.__formes: - s += '\n' + str(f) - return s \ No newline at end of file diff --git a/TD1/correction/code/test_formes.py b/TD1/correction/code/test_formes.py deleted file mode 100755 index 171840f6290ef94f6a718c39381446c3f96d05e0..0000000000000000000000000000000000000000 --- a/TD1/correction/code/test_formes.py +++ /dev/null @@ -1,33 +0,0 @@ -from formes import * - -def test_Rectangle(): - r = Rectangle(10, 20, 100, 50) - str(r) - assert r.contient_point(50, 50) - assert not r.contient_point(0, 0) - r.redimension_par_points(100, 200, 1100, 700) - assert r.contient_point(500, 500) - assert not r.contient_point(50, 50) - -def test_Ellipse(): - e = Ellipse(60, 45, 50, 25) - str(e) - assert e.contient_point(50, 50) - assert not e.contient_point(11, 21) - e.redimension_par_points(100, 200, 1100, 700) - assert e.contient_point(500, 500) - assert not e.contient_point(101, 201) - -def test_Cercle(): - c = Cercle(10, 20, 30) - str(c) - assert c.contient_point(0, 0) - assert not c.contient_point(-19, -9) - c.redimension_par_points(100, 200, 1100, 700) - assert c.contient_point(500, 500) - assert not c.contient_point(599, 500) - -if __name__ == '__main__': - test_Rectangle() - test_Ellipse() - test_Cercle() diff --git a/TD1/correction/code/test_formes_avec_dessin.py b/TD1/correction/code/test_formes_avec_dessin.py deleted file mode 100644 index 343b02cffd73bf486a1ea1a6667adb8323885668..0000000000000000000000000000000000000000 --- a/TD1/correction/code/test_formes_avec_dessin.py +++ /dev/null @@ -1,68 +0,0 @@ -from formes_avec_dessin import * - -def test_Rectangle(): - r = Rectangle(10, 20, 100, 50) - str(r) - assert r.contient_point(50, 50) - assert not r.contient_point(0, 0) - r.redimension_par_points(100, 200, 1100, 700) - assert r.contient_point(500, 500) - assert not r.contient_point(50, 50) - -def test_Ellipse(): - e = Ellipse(60, 45, 50, 25) - str(e) - assert e.contient_point(50, 50) - assert not e.contient_point(11, 21) - e.redimension_par_points(100, 200, 1100, 700) - assert e.contient_point(500, 500) - assert not e.contient_point(101, 201) - -def test_Cercle(): - c = Cercle(10, 20, 30) - str(c) - assert c.contient_point(0, 0) - assert not c.contient_point(-19, -9) - c.redimension_par_points(100, 200, 1100, 700) - assert c.contient_point(500, 500) - assert not c.contient_point(599, 500) - -def test_Dessin(): - # Partie pour aller plus loin : Creation et manipulation d'objets Dessin - - r = Rectangle(10, 20, 100, 50) - e = Ellipse(60, 45, 50, 25) - c = Cercle(10, 20, 30) - - print("Création d'un dessin A composé des trois formes") - d1 = Dessin("A") - d1.add_forme(r) - d1.add_forme(e) - d1.add_forme(c) - d1.print_formes() - - print("Création d'un dessin B composé de l'ellipse et du cercle") - d2 = Dessin("B") - d2.add_forme(e) - d2.add_forme(c) - d2.print_formes() - - print("Affichage des dessins auxquels les formes sont associées") - r.print_dessins() - e.print_dessins() - c.print_dessins() - - print("Suppression de l'ellipse dans le dessin A") - d1.del_forme(1) - print(d1) - - print("Affichage des dessins auxquels les formes sont associées") - r.print_dessins() - e.print_dessins() - c.print_dessins() - -if __name__ == '__main__': - test_Rectangle() - test_Ellipse() - test_Cercle() - test_Dessin() diff --git a/TD1/correction/diagramme_classes_formes.png b/TD1/correction/diagramme_classes_formes.png deleted file mode 100644 index 0368318a11ea4296a45af7e69fe928c7d5df2f73..0000000000000000000000000000000000000000 Binary files a/TD1/correction/diagramme_classes_formes.png and /dev/null differ diff --git a/TD1/correction/diagramme_classes_formes_avec_dessin.png b/TD1/correction/diagramme_classes_formes_avec_dessin.png deleted file mode 100644 index 1a1993089d4961025a34b24c9e1409f9c7aca18f..0000000000000000000000000000000000000000 Binary files a/TD1/correction/diagramme_classes_formes_avec_dessin.png and /dev/null differ diff --git a/TD2/correction/code/bibliotheque.py b/TD2/correction/code/bibliotheque.py deleted file mode 100755 index b493ead3f83228ce29420791f060f780736fec5e..0000000000000000000000000000000000000000 --- a/TD2/correction/code/bibliotheque.py +++ /dev/null @@ -1,139 +0,0 @@ -# -*- coding: utf-8 -*- -""" - -@author: dellandrea -""" -from lecteur import * -from livre import * -from emprunt import * - - -# ***** classe Bibliotheque ***** -class Bibliotheque: - def __init__(self,nom): - self.__nom = nom - self.__lecteurs = [] - self.__livres = [] - self.__emprunts = [] - - def get_nom(self): - return self.__nom - - def ajout_lecteur(self,nom,prenom,adresse,numero): - self.__lecteurs.append(Lecteur(nom,prenom,adresse,numero)) - - def retrait_lecteur(self,numero): - # On cherche le lecteur - lecteur = self.chercher_lecteur_numero(numero) - if lecteur == None: - return False - # On verifie qu'il n'a pas d'emprunt en cours - for e in self.__emprunts: - if e.get_numero_lecteur()==numero: - return False - # On peut ici retirer le lecteur de la liste - self.__lecteurs.remove(lecteur) - return True - - def ajout_livre(self,auteur,titre,numero,nb_total): - self.__livres.append(Livre(auteur,titre,numero,nb_total)) - - def retrait_livre(self,numero): - # On cherche le livre - livre = self.chercher_livre_numero(numero) - if livre == None: - return False - # On verifie que le livre n'est pas en cours d'emprunt - for e in self.__emprunts: - if e.get_numero_livre()==numero: - return False - # On peut ici retirer le livre de la liste - self.__livres.remove(livre) - return True - - def chercher_lecteur_numero(self,numero): - for l in self.__lecteurs: - if l.get_numero() == numero: - return l - return None - - def chercher_lecteur_nom(self,nom,prenom): - for l in self.__lecteurs: - if l.get_nom() == nom and l.get_prenom() == prenom: - return l - return None - - def chercher_livre_numero(self,numero): - for l in self.__livres: - if l.get_numero() == numero: - return l - return None - - def chercher_livre_titre(self,titre): - for l in self.__livres: - if l.get_titre() == titre: - return l - return None - - def chercher_emprunt(self, numero_lecteur, numero_livre): - for e in self.__emprunts: - if e.get_numero_lecteur() == numero_lecteur and e.get_numero_livre() == numero_livre: - return e - return None - - def emprunt_livre(self, numero_lecteur, numero_livre): - # On verifie que le numero de livre est valide - livre = self.chercher_livre_numero(numero_livre) - if livre == None: - print('Emprunt impossible : livre inexistant') - return None - - # On verifie qu'il reste des exemplaires disponibles pour ce livre - if livre.get_nb_dispo() == 0: - print('Emprunt impossible : plus d\'exemplaires disponibles') - return None - - # On verifie que le numero de lecteur est valide - lecteur = self.chercher_lecteur_numero(numero_lecteur) - if lecteur == None: - print('Emprunt impossible : lecteur inexistant') - return None - # On verifie que ce lecteur n'a pas deja emprunte ce livre - e = self.chercher_emprunt(numero_lecteur, numero_livre) - if e != None: - print('Emprunt impossible : deja en cours') - return None - - # Les conditions sont reunies pour pouvoir faire cet emprunt - self.__emprunts.append(Emprunt(numero_lecteur, numero_livre)) - livre.set_nb_dispo(livre.get_nb_dispo()-1) - lecteur.set_nb_emprunts(lecteur.get_nb_emprunts()+1) - return self.__emprunts[-1] - - def retour_livre(self, numero_lecteur, numero_livre): - # On recherche l'emprunt identifie par le numero de livre et de lecteur - e = self.chercher_emprunt(numero_lecteur, numero_livre) - if e != None: # l'emprunt existe, on le retire de la liste et on met a jour nb_emprunt pour le lecteur et nb_dispo pour le livre - self.__emprunts.remove(e) - lecteur = self.chercher_lecteur_numero(numero_lecteur) - if lecteur != None : lecteur.set_nb_emprunts(lecteur.get_nb_emprunts()-1) - livre = self.chercher_livre_numero(numero_livre) - if livre != None: livre.set_nb_dispo(livre.get_nb_dispo()+1) - print('Retour effectue') - return True - else: - print('Aucun emprunt ne correspond a ces informations') - return False - - def affiche_lecteurs(self): - for l in self.__lecteurs: - print(l) - - def affiche_livres(self): - for l in self.__livres: - print(l) - - def affiche_emprunts(self): - for e in self.__emprunts: - print(e) - diff --git a/TD2/correction/code/emprunt.py b/TD2/correction/code/emprunt.py deleted file mode 100644 index 1ca812a9f9322525f814b71f624d75f64c5ab1c0..0000000000000000000000000000000000000000 --- a/TD2/correction/code/emprunt.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -Created on Tue Sep 20 07:27:13 2022 - -@author: dellandrea -""" - -from datetime import date -from lecteur import * -from livre import * - -# ***** classe Emprunt ***** -class Emprunt: - def __init__(self,numero_lecteur,numero_livre): - self.__numero_lecteur = numero_lecteur - self.__numero_livre = numero_livre - self.__date = date.isoformat(date.today()) - - def get_numero_lecteur(self): - return self.__numero_lecteur - - def get_numero_livre(self): - return self.__numero_livre - - def get_date(self): - return self.__date - - def __str__(self): - return 'Emprunt - Numero lecteur : {}, Numero livre: {}, Date : {}'.format(self.__numero_lecteur,self.__numero_livre,self.__date) - \ No newline at end of file diff --git a/TD2/correction/code/lecteur.py b/TD2/correction/code/lecteur.py deleted file mode 100644 index 5fca8b826a59cee5e379ce205faa32948d92a761..0000000000000000000000000000000000000000 --- a/TD2/correction/code/lecteur.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -Created on Tue Sep 20 07:25:52 2022 - -@author: dellandrea -""" - -from personne import * - -# ***** classe Lecteur ***** -class Lecteur(Personne): - def __init__(self,nom,prenom,adresse,numero): - Personne.__init__(self,nom,prenom,adresse) - self.__numero = numero - self.__nb_emprunts = 0 - - def set_numero(self,numero): - self.__numero = numero - - def get_numero(self): - return self.__numero - - def set_nb_emprunts(self,nb_emprunts): - self.__nb_emprunts = nb_emprunts - - def get_nb_emprunts(self): - return self.__nb_emprunts - - def __str__(self): #Permet d'afficher les proprietes de l'objet avec la fonction print - return 'Lecteur - Nom : {}, Prenom : {}, Adresse : {}, Numero : {}, Nb emprunts : {}'.format(self.get_nom(),self.get_prenom(),self.get_adresse(),self.__numero,self.__nb_emprunts) diff --git a/TD2/correction/code/livre.py b/TD2/correction/code/livre.py deleted file mode 100644 index 06ec6cca573cdd5325ea5e93f32e7cee6a0711e4..0000000000000000000000000000000000000000 --- a/TD2/correction/code/livre.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -Created on Tue Sep 20 07:26:54 2022 - -@author: dellandrea -""" - -# ***** classe Livre ***** -class Livre: - def __init__(self,titre,auteur,numero,nb_total): - self.__titre = titre - self.__auteur = auteur - self.__numero = numero - self.__nb_total = nb_total - self.__nb_dispo = nb_total - - def set_auteur(self,auteur): - self.__auteur = auteur - - def get_auteur(self): - return self.__auteur - - def set_titre(self,titre): - self.__titre = titre - - def get_titre(self): - return self.__titre - - def set_numero(self,numero): - self.__numero = numero - - def get_numero(self): - return self.__numero - - def set_nb_total(self,nb_total): - self.__nb_total = nb_total - - def get_nb_total(self): - return self.__nb_total - - def set_nb_dispo(self,nb_dispo): - self.__nb_dispo = nb_dispo - - def get_nb_dispo(self): - return self.__nb_dispo - - def __str__(self): - return 'Livre - Auteur : {}, Titre : {}, Numero : {}, Nb total : {}, Nb dispo : {}'.format(self.__auteur,self.__titre,self.__numero,self.__nb_total,self.__nb_dispo) diff --git a/TD2/correction/code/personne.py b/TD2/correction/code/personne.py deleted file mode 100644 index 3acd65ef8a305d9301b8bbebab4fc76b26313ca7..0000000000000000000000000000000000000000 --- a/TD2/correction/code/personne.py +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -Created on Tue Sep 20 07:21:05 2022 - -@author: dellandrea -""" - -# ***** classe Personne ***** -class Personne: - def __init__(self,nom,prenom,adresse): - self.__nom = nom - self.__prenom = prenom - self.__adresse = adresse - - def __str__(self): - return f"Classe Personne - Nom : {self.__nom}, Prenom : {self.__prenom}, Adresse : {self.__adresse}" - - def set_nom(self,nom): - self.__nom = nom - - def get_nom(self): - return self.__nom - - def set_prenom(self,prenom): - self.__prenom = prenom - - def get_prenom(self): - return self.__prenom - - def set_adresse(self,adresse): - self.__adresse = adresse - - def get_adresse(self): - return self.__adresse \ No newline at end of file diff --git a/TD2/correction/code/test_bibliotheque.py b/TD2/correction/code/test_bibliotheque.py deleted file mode 100755 index da5096ee2c8fa3bd0e96c6ab6853fb1924c0f275..0000000000000000000000000000000000000000 --- a/TD2/correction/code/test_bibliotheque.py +++ /dev/null @@ -1,171 +0,0 @@ -# -*- coding: utf-8 -*- -""" - -@author: dellandrea -""" - -from bibliotheque import * - -# Creation d'une bibliotheque -b = Bibliotheque('Bibliotheque ECL') - -# Ajout de lecteurs -b.ajout_lecteur('Duval','Pierre','rue de la Paix',1) -b.ajout_lecteur('Dupond','Laurent','rue de la Gare',2) -b.ajout_lecteur('Martin','Marie','rue La Fayette',3) -b.ajout_lecteur('Dubois','Sophie','rue du Stade',4) - -# Ajout de livres -b.ajout_livre('Le Pere Goriot','Honore de Balzac',101,2) -b.ajout_livre('Les Hauts de Hurlevent','Emilie Bronte',102,2) -b.ajout_livre('Le Petit Prince','Antoine de Saint Exupery',103,2) -b.ajout_livre('L\'Etranger','Albert Camus',104,2) - -# Affichage des lecteurs et des livres -print('\n--- Liste des lecteurs :') -print('-------------------------------') -b.affiche_lecteurs() -print('\n--- Liste des livres :') -print('-------------------------------') -b.affiche_livres() - -# Recherches de lecteurs par numero -print('\n--- Recherche de lecteurs :') -print('-------------------------------') -lect = b.chercher_lecteur_numero(1) -if lect != None: - print(lect) -else: - print('Lecteur non trouve') - -lect = b.chercher_lecteur_numero(6) -if lect != None: - print(lect) -else: - print('Lecteur non trouve') - -# Recherches de lecteurs par nom -lect = b.chercher_lecteur_nom('Martin','Marie') -if lect != None: - print(lect) -else: - print('Lecteur non trouve') - -lect = b.chercher_lecteur_nom('Le Grand','Paul') -if lect != None: - print(lect) -else: - print('Lecteur non trouve') - -# Recherches de livres par numero -print('\n--- Recherche de livres :') -print('-------------------------------') -livre = b.chercher_livre_numero(101) -if livre != None: - print('Livre trouve :',livre) -else: - print('Livre non trouve') - -livre = b.chercher_livre_numero(106) -if livre != None: - print('Livre trouve :',livre) -else: - print('Livre non trouve') - -# Recherches de livres par titre -livre = b.chercher_livre_titre('Les Hauts de Hurlevent') -if livre != None: - print('Livre trouve :',livre) -else: - print('Livre non trouve') - -livre = b.chercher_livre_titre('Madame Bovarie') -if livre != None: - print('Livre trouve :',livre) -else: - print('Livre non trouve') - -# Quelques emprunts -print('\n--- Quelques emprunts :') -print('-------------------------------') -b.emprunt_livre(1,101) -b.emprunt_livre(1,104) -b.emprunt_livre(2,101) -b.emprunt_livre(2,105) -b.emprunt_livre(3,101) -b.emprunt_livre(3,104) -b.emprunt_livre(4,102) -b.emprunt_livre(4,103) - -# Affichage des emprunts, des lecteurs et des livres -print('\n--- Liste des emprunts :') -print('-------------------------------') -b.affiche_emprunts() -print('\n--- Liste des lecteurs :') -print('-------------------------------') -b.affiche_lecteurs() -print('\n--- Liste des livres :') -print('-------------------------------') -b.affiche_livres() - -# Quelques retours de livres -print('\n--- Quelques retours de livres :') -print('-------------------------------') -b.retour_livre(1,101) -b.retour_livre(1,102) -b.retour_livre(3,104) -b.retour_livre(10,108) - -# Affichage des emprunts, des lecteurs et des livres -print('\n--- Liste des emprunts :') -print('-------------------------------') -b.affiche_emprunts() -print('\n--- Liste des lecteurs :') -print('-------------------------------') -b.affiche_lecteurs() -print('\n--- Liste des livres :') -print('-------------------------------') -b.affiche_livres() - -# Suppression de quelques livres -rep = b.retrait_livre(101) -if not rep: - print('Retrait du livre impossible') -else: - print('Retrait du livre effectue') - -b.retour_livre(2,101) - -rep = b.retrait_livre(101) -if not rep: - print('Retrait du livre impossible') -else: - print('Retrait du livre effectue') - -# Suppression de quelques lecteurs -rep = b.retrait_lecteur(1) -if not rep: - print('Retrait du lecteur impossible') -else: - print('Retrait du lecteur effectue') - -b.retour_livre(1,104) - -rep = b.retrait_lecteur(1) -if not rep: - print('Retrait du lecteur impossible') -else: - print('Retrait du lecteur effectue') - -# Affichage des emprunts, des lecteurs et des livres -print('\n--- Liste des emprunts :') -print('-------------------------------') -b.affiche_emprunts() -print('\n--- Liste des lecteurs :') -print('-------------------------------') -b.affiche_lecteurs() -print('\n--- Liste des livres :') -print('-------------------------------') -b.affiche_livres() - - diff --git a/TD2/correction/code/test_emprunt.py b/TD2/correction/code/test_emprunt.py deleted file mode 100644 index 4f4f2f5614d9c57f166d8128d72f545d68a9975b..0000000000000000000000000000000000000000 --- a/TD2/correction/code/test_emprunt.py +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -Created on Tue Sep 20 07:46:54 2022 - -@author: dellandrea -""" - -from emprunt import * - -e = Emprunt(3,5) -print(e) - -print(e.get_numero_lecteur()) -print(e.get_numero_livre()) -print(e.get_date()) \ No newline at end of file diff --git a/TD2/correction/code/test_lecteur.py b/TD2/correction/code/test_lecteur.py deleted file mode 100644 index 6cacc7ae3241f26279841088db0a2fe70daed211..0000000000000000000000000000000000000000 --- a/TD2/correction/code/test_lecteur.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -Created on Tue Sep 20 07:21:29 2022 - -@author: dellandrea -""" - -from lecteur import * - -l = Lecteur("Durand","Marie","Ecully",13) - -print(l) - -l.set_nom("Dupond") -print(l.get_nom()) - - -l.set_prenom("Emilie") -print(l.get_prenom()) - -l.set_adresse("Lyon") -print(l.get_adresse()) - -l.set_numero(14) -print(l.get_numero()) - -l.set_nb_emprunts(2) -print(l.get_nb_emprunts()) - -print(l) \ No newline at end of file diff --git a/TD2/correction/code/test_livre.py b/TD2/correction/code/test_livre.py deleted file mode 100644 index 5a5cc23fd313cc67fb9553b22548c7c41c759f68..0000000000000000000000000000000000000000 --- a/TD2/correction/code/test_livre.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -Created on Tue Sep 20 07:41:02 2022 - -@author: dellandrea -""" - -from livre import * - -l = Livre('Le Pere Goriot','Honore de Balzac',101,2) -print(l) - -l.set_auteur("Emilie Bronte") -print(l.get_auteur()) - -l.set_titre("Les Hauts de Hurlevent") -print(l.get_titre()) - -l.set_numero(102) -print(l.get_numero()) - -l.set_nb_total(5) -print(l.get_nb_total()) - -l.set_nb_dispo(4) -print(l.get_nb_dispo()) - -print(l) \ No newline at end of file diff --git a/TD2/correction/code/test_personne.py b/TD2/correction/code/test_personne.py deleted file mode 100644 index 1134161fc498ca55555c61607a2d72d5344983e5..0000000000000000000000000000000000000000 --- a/TD2/correction/code/test_personne.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -Created on Tue Sep 20 07:21:29 2022 - -@author: dellandrea -""" - -from personne import * - -p = Personne("Durand","Marie","Ecully") - -print(p) - -p.set_nom("Dupond") -print(p.get_nom()) - - -p.set_prenom("Emilie") -print(p.get_prenom()) - -p.set_adresse("Lyon") -print(p.get_adresse()) - -print(p) \ No newline at end of file diff --git a/TD2/correction/diagramme_classes_biblio.png b/TD2/correction/diagramme_classes_biblio.png deleted file mode 100644 index 1248f4b9e31c6ee35c116a391ea8fa1ab8a4333e..0000000000000000000000000000000000000000 Binary files a/TD2/correction/diagramme_classes_biblio.png and /dev/null differ diff --git a/TD3/correction/club.py b/TD3/correction/club.py deleted file mode 100644 index 0baa2eb0d887674e13929d463087f561fe34b430..0000000000000000000000000000000000000000 --- a/TD3/correction/club.py +++ /dev/null @@ -1,86 +0,0 @@ -class Personne: - def __init__(self,nom): - self.__nom = nom - - def get_nom(self): - return self.__nom - -class Adherent(Personne): - def __init__(self,nom,num): - Personne.__init__(self,nom) - self.__numero = num - - def get_numero(self): - return self.__numero - -class Activite: - def __init__(self,n): - self.__nom = n - self.__adherents = [] - - def get_nom(self): - return self.__nom - - def ajout_adherent(self,a): - self.__adherents.append(a) - - def affiche_adherents(self): - print('Liste des adherents:') - for a in self.__adherents: - print('Nom : {} - Numero : {}'.format(a.get_nom(), a.get_numero())) - -class Club: - def __init__(self,n): - self.__nom = n - self.__adherents = [] - self.__activites = [] - - def ajout_adherent(self,nom,num): - self.__adherents.append(Adherent(nom,num)) - - def ajout_activite(self,n): - self.__activites.append(Activite(n)) - - def associe(self,numAdherent,nomActivite): - ac = None - for a in self.__activites: - if a.get_nom() == nomActivite: - ac = a - break - - ad = None - for a in self.__adherents: - if a.get_numero() == numAdherent: - ad = a - break - - if ac != None and ad != None : - ac.ajout_adherent(ad) - - def affiche_activites(self): - print('Liste des activites:') - for a in self.__activites: - print('- Nom :',a.get_nom()) - a.affiche_adherents() - -if __name__ == '__main__': - c = Club('Ecully') - c.ajout_adherent('Paul',1) - c.ajout_adherent('Marc',2) - c.ajout_adherent('Marie',3) - - c.ajout_activite('Escalade') - c.ajout_activite('Theatre') - c.ajout_activite('Football') - - c.associe(1,'Theatre') - c.associe(2,'Theatre') - c.associe(3,'Theatre') - - c.associe(2,'Escalade') - c.associe(3,'Escalade') - - c.affiche_activites() - - - diff --git a/TD3/correction/diagramme_classes_hotel.png b/TD3/correction/diagramme_classes_hotel.png deleted file mode 100755 index 55754a58d7453fb83b5b8d8757e35aa2d6010666..0000000000000000000000000000000000000000 Binary files a/TD3/correction/diagramme_classes_hotel.png and /dev/null differ diff --git a/TD3/correction/diagramme_classes_restaurant.png b/TD3/correction/diagramme_classes_restaurant.png deleted file mode 100644 index 928f41b8b42ac938de4b6953aa43dd48eda72aea..0000000000000000000000000000000000000000 Binary files a/TD3/correction/diagramme_classes_restaurant.png and /dev/null differ diff --git a/TD3/correction/diagramme_classes_theatre.png b/TD3/correction/diagramme_classes_theatre.png deleted file mode 100755 index 2c01778ced1a314c99bc9937378da86ab935e494..0000000000000000000000000000000000000000 Binary files a/TD3/correction/diagramme_classes_theatre.png and /dev/null differ diff --git a/TD3/correction/hotel.py b/TD3/correction/hotel.py deleted file mode 100644 index 41ab2c1adeccba46235de06e278f0894ccc570f9..0000000000000000000000000000000000000000 --- a/TD3/correction/hotel.py +++ /dev/null @@ -1,105 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -Created on Tue Sep 20 14:05:14 2022 - -@author: dellandrea -""" - -class Personne: - def __init__(self,nom): - self.nom = nom - - def __str__(self): - return f"Classe Personne - nom : {self.nom}" - - -class Client(Personne): - def __init__(self,nom): - Personne.__init__(self, nom) - self.hotels = [] - self.chambres = [] - - def __str__(self): - return f"Classe Client - nom : {self.nom}" - -class Directeur(Personne): - def __init__(self,nom): - Personne.__init__(self, nom) - self.hotels = [] - - def __str__(self): - return f"Classe Directeur - nom : {self.nom}" - -class Television: - def __init__(self,nom): - self.nom = nom - self.chambre = None - - def __str__(self): - return f"Classe Television - nom : {self.nom}" - -class Lit: - def __init__(self,nom): - self.nom = nom - self.chambre = None - - def __str__(self): - return f"Classe Lit - nom : {self.nom}" - -class Salle_de_bain: - def __init__(self,nom): - self.nom = nom - self.chambre = None - - def __str__(self): - return f"Classe Salle_de_bain - nom : {self.nom}" - -class Chambre: - def __init__(self,nom,hotel,nom_tele,nom_lit,nom_sdb): - self.nom = nom - self.hotel = hotel - self.clients = [] - self.television = Television(nom_tele) - self.lit = Lit(nom_lit) - self.salle_de_bain = Salle_de_bain(nom_sdb) - - def __str__(self): - return f"Classe Chambre - nom : {self.nom}" - - -class Hotel: - def __init__(self,nom): - self.nom = nom - self.directeur = None - self.clients = [] - self.chambres = [] - - def __str__(self): - return f"Classe Hotel - nom : {self.nom}" - -if __name__ == '__main__': - - p = Personne("Marie") - print(p) - - cl = Client("Charles") - print(cl) - - d = Directeur("Maxime") - print(d) - - h = Hotel("L'Europeen") - print(h) - - sdb = Salle_de_bain("Ocean") - print(sdb) - - t = Television("Tashibo") - print(t) - - l = Lit("Confort") - print(l) - - ch = Chambre("101",h,"Samsing","Relax","Plage") - print(ch) \ No newline at end of file diff --git a/TD3/correction/restaurant.py b/TD3/correction/restaurant.py deleted file mode 100644 index b35062bf366e52131328675b3ffa7e0f715e0483..0000000000000000000000000000000000000000 --- a/TD3/correction/restaurant.py +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -Created on Tue Sep 20 14:05:14 2022 - -@author: dellandrea -""" - -class Personne: - def __init__(self,nom): - self.nom = nom - - def __str__(self): - return f"Classe Personne - nom : {self.nom}" - - -class Client(Personne): - def __init__(self,nom): - Personne.__init__(self, nom) - self.restaurants = [] - self.plats = [] - - def __str__(self): - return f"Classe Client - nom : {self.nom}" - -class Serveur(Personne): - def __init__(self,nom): - Personne.__init__(self, nom) - self.restaurant = None - self.plats = [] - - def __str__(self): - return f"Classe Serveur - nom : {self.nom}" - -class Directeur(Personne): - def __init__(self,nom): - Personne.__init__(self, nom) - self.restaurants = [] - - def __str__(self): - return f"Classe Directeur - nom : {self.nom}" - -class Cuisinier(Personne): - def __init__(self,nom): - Personne.__init__(self, nom) - self.restaurant = None - self.plats = [] - - def __str__(self): - return f"Classe Cuisinier - nom : {self.nom}" - - -class Plat: - def __init__(self,nom): - self.nom = nom - self.restaurants = [] - self.cuisiniers = [] - self.serveurs = [] - self.clients = [] - - def __str__(self): - return f"Classe Plat - nom : {self.nom}" - -class Restaurant: - def __init__(self,nom): - self.nom = nom - self.directeur = None - self.cuisiniers = [] - self.serveurs = [] - self.clients = [] - self.plats = [] - - def __str__(self): - return f"Classe Restaurant - nom : {self.nom}" - -if __name__ == '__main__': - - p = Personne("Marie") - print(p) - - cl = Client("Charles") - print(cl) - - s = Serveur("Paul") - print(s) - - d = Directeur("Maxime") - print(d) - - cu = Cuisinier("Sabine") - print(cu) - - p = Plat("Lasagnes") - print(p) - - r = Restaurant("Chez Lulu") - print(r) \ No newline at end of file diff --git a/TD3/correction/theatre.py b/TD3/correction/theatre.py deleted file mode 100644 index c8112242527a5e827c4444f8a0fc29720c49d053..0000000000000000000000000000000000000000 --- a/TD3/correction/theatre.py +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -Created on Tue Sep 20 14:05:14 2022 - -@author: dellandrea -""" - -class Personne: - def __init__(self,nom): - self.nom = nom - - def __str__(self): - return f"Classe Personne - nom : {self.nom}" - - -class Acteur(Personne): - def __init__(self,nom): - Personne.__init__(self, nom) - self.theatres = [] - self.costumes = [] - self.pieces_de_theatre = [] - - def __str__(self): - return f"Classe Acteur - nom : {self.nom}" - -class Costumier(Personne): - def __init__(self,nom): - Personne.__init__(self, nom) - self.theatre = None - self.costumes = [] - - def __str__(self): - return f"Classe Costumier - nom : {self.nom}" - -class Metteur_en_scene(Personne): - def __init__(self,nom): - Personne.__init__(self, nom) - self.theatres = [] - self.pieces_de_theatre = [] - - def __str__(self): - return f"Classe Metteur_en_scene - nom : {self.nom}" - -class Piece_de_theatre: - def __init__(self,nom): - self.nom = nom - self.theatres = [] - self.acteurs = [] - self.metteur_en_scene = None - - def __str__(self): - return f"Classe Piece_de_theatre - nom : {self.nom}" - -class Costume: - def __init__(self,nom): - self.nom = nom - self.theatre = None - self.acteurs = [] - self.costumiers = [] - - def __str__(self): - return f"Classe Costume - nom : {self.nom}" - -class Theatre: - def __init__(self,nom): - self.nom = nom - self.metteurs_en_scene = [] - self.pieces_de_theatre = [] - self.acteurs = [] - self.costumiers = [] - self.costumes = [] - - def __str__(self): - return f"Classe Theatre - nom : {self.nom}" - -if __name__ == '__main__': - - p = Personne("Marie") - print(p) - - a = Acteur("Charles") - print(a) - - c = Costumier("Paul") - print(c) - - m = Metteur_en_scene("Delphine") - print(m) - - pi = Piece_de_theatre("Hamlet") - print(pi) - - co = Costume("Chique") - print(co) - - t = Theatre("La Comédie Française") - print(t) \ No newline at end of file diff --git a/TD4/correction/code/application_dessin.py b/TD4/correction/code/application_dessin.py deleted file mode 100644 index cadc000b5fd9d6ac82f27b49922aa5dadda18b75..0000000000000000000000000000000000000000 --- a/TD4/correction/code/application_dessin.py +++ /dev/null @@ -1,73 +0,0 @@ -from tkinter import * -from tkinter import colorchooser # doit être importé manuellement -from formes import * - -class ZoneAffichage(Canvas): - def __init__(self, master, largeur, hauteur): - Canvas.__init__(self, master, width=largeur, height=hauteur) - self.__formes = [] - self.__type_forme = 'rectangle' - self.__couleur = 'brown' - - def selection_rectangle(self): - self.__type_forme = 'rectangle' - - def selection_ellipse(self): - self.__type_forme = 'ellipse' - - def selection_couleur(self): - self.__couleur = colorchooser.askcolor()[1] - - def ajout_forme(self, x, y): - # Notez qu'on aurait aussi pu ajouter ce code en méthodes de Rectangle/Ellipse. - if self.__type_forme == 'rectangle': - f = Rectangle(self, x-5, y-10, 10, 20, self.__couleur) - elif self.__type_forme == 'ellipse': - f = Ellipse(self, x, y, 5, 10, self.__couleur) - self.__formes.append(f) - - def suppression_forme(self, x, y): - for f in self.__formes[::-1]: - if f.contient_point(x, y): - self.__formes.remove(f) - f.effacer() - break - - -class FenPrincipale(Tk): - def __init__(self): - Tk.__init__(self) - - # disposition des composants de l'interface - self.configure(bg="grey") - barreOutils = Frame(self) - barreOutils.pack(side=TOP) - boutonRectangle = Button(barreOutils, text="Rectangle") - boutonRectangle.pack(side=LEFT, padx=5, pady=5) - boutonEllipse = Button(barreOutils, text="Ellipse") - boutonEllipse.pack(side=LEFT, padx=5, pady=5) - boutonCouleur = Button(barreOutils, text="Couleur") - boutonCouleur.pack(side=LEFT, padx=5, pady=5) - boutonQuitter = Button(barreOutils, text="Quitter") - boutonQuitter.pack(side=LEFT, padx=5, pady=5) - self.__canevas = ZoneAffichage(self, 600, 400) - self.__canevas.pack(side=TOP, padx=10, pady=10) - - # commandes - boutonRectangle.config(command=self.__canevas.selection_rectangle) - boutonEllipse.config(command=self.__canevas.selection_ellipse) - boutonCouleur.config(command=self.__canevas.selection_couleur) - boutonQuitter.config(command=self.destroy) - self.__canevas.bind("<Control-ButtonRelease-1>", self.control_clic_canevas) - self.__canevas.bind("<ButtonRelease-1>", self.release_canevas) - - def control_clic_canevas(self, event): - self.__canevas.suppression_forme(event.x, event.y) - - def release_canevas(self, event): - self.__canevas.ajout_forme(event.x, event.y) - - -if __name__ == '__main__': - fen = FenPrincipale() - fen.mainloop() diff --git a/TD4/correction/code/formes.py b/TD4/correction/code/formes.py deleted file mode 100644 index ac8029a36a88c8455df315ea864426afb04ec479..0000000000000000000000000000000000000000 --- a/TD4/correction/code/formes.py +++ /dev/null @@ -1,88 +0,0 @@ -class Forme: - def __init__(self, canevas, x, y): - self.__canevas = canevas - self.__item = None - self.x = x - self.y = y - - def effacer(self): - self.__canevas.delete(self.__item) - - def deplacement(self, dx, dy): - self.__canevas.move(self.__item, dx, dy) - self.x += dx - self.y += dy - - def get_cavenas(self): - return self.__canevas - - def set_item(self,item): - self.__item = item - - def get_item(self): - return self.__item - -class Rectangle(Forme): - def __init__(self, canevas, x, y, l, h, couleur): - Forme.__init__(self, canevas, x, y) - item = canevas.create_rectangle(x, y, x+l, y+h, fill=couleur) - self.set_item(item) - self.__l = l - self.__h = h - - def __str__(self): - return f"Rectangle d'origine {self.x},{self.y} et de dimensions {self.__l}x{self.__h}" - - def get_dim(self): - return self.__l, self.__h - - def set_dim(self, l, h): - self.__l = l - self.__h = h - - def contient_point(self, x, y): - return self.x <= x <= self.x + self.__l and \ - self.y <= y <= self.y + self.__h - - def redimension_par_points(self, x0, y0, x1, y1): - self.x = min(x0, x1) - self.y = min(y0, y1) - self.__l = abs(x0 - x1) - self.__h = abs(y0 - y1) - - def update_coord_shape(self): - can = self.get_cavenas() - can.coords(self.get_item(), self.x, self.y, self.x+self.__l, self.y+self.__h) - - -class Ellipse(Forme): - def __init__(self, canevas, x, y, rx, ry, couleur): - Forme.__init__(self, canevas, x, y) - item = canevas.create_oval(x-rx, y-ry, x+rx, y+ry, fill=couleur) - self.set_item(item) - self.__rx = rx - self.__ry = ry - - def __str__(self): - return f"Ellipse de centre {self.x},{self.y} et de rayons {self.__rx}x{self.__ry}" - - def get_dim(self): - return self.__rx, self.__ry - - def set_dim(self, rx, ry): - self.__rx = rx - self.__ry = ry - - def contient_point(self, x, y): - return ((x - self.x) / self.__rx) ** 2 + ((y - self.y) / self.__ry) ** 2 <= 1 - - def redimension_par_points(self, x0, y0, x1, y1): - self.x = (x0 + x1) // 2 - self.y = (y0 + y1) // 2 - self.__rx = abs(x0 - x1) / 2 - self.__ry = abs(y0 - y1) / 2 - - def update_coord_shape(self): - can = self.get_cavenas() - can.coords(self.get_item(), self.x-self.__rx, self.y-self.__ry, self.x+self.__rx, self.y+self.__ry) - diff --git a/TD5/correction/code/formes.py b/TD5/correction/code/formes.py deleted file mode 100644 index 434ce0b406b424947efe4dce44b199117aed5d9a..0000000000000000000000000000000000000000 --- a/TD5/correction/code/formes.py +++ /dev/null @@ -1,81 +0,0 @@ -class Forme: - def __init__(self, canevas, x, y): - self.__canevas = canevas - self.__item = None - self.x = x - self.y = y - - def effacer(self): - self.__canevas.delete(self.__item) - - def deplacement(self, dx, dy): - self.__canevas.move(self.__item, dx, dy) - self.x += dx - self.y += dy - - def get_cavenas(self): - return self.__canevas - - def set_item(self,item): - self.__item = item - - def get_item(self): - return self.__item - - def set_state(self, s): - self.__canevas.itemconfig(self.__item, state=s) - -class Rectangle(Forme): - def __init__(self, canevas, x, y, l, h, couleur): - Forme.__init__(self, canevas, x, y) - item = canevas.create_rectangle(x, y, x+l, y+h, fill=couleur, state="hidden") - self.set_item(item) - self.__l = l - self.__h = h - - def __str__(self): - return f"Rectangle d'origine {self.x},{self.y} et de dimensions {self.__l}x{self.__h}" - - def get_dim(self): - return self.__l, self.__h - - def set_dim(self, l, h): - self.__l = l - self.__h = h - - def contient_point(self, x, y): - return self.x <= x <= self.x + self.__l and \ - self.y <= y <= self.y + self.__h - - def redimension_par_points(self, x0, y0, x1, y1): - self.x = min(x0, x1) - self.y = min(y0, y1) - self.__l = abs(x0 - x1) - self.__h = abs(y0 - y1) - -class Ellipse(Forme): - def __init__(self, canevas, x, y, rx, ry, couleur): - Forme.__init__(self, canevas, x, y) - item = canevas.create_oval(x-rx, y-ry, x+rx, y+ry, fill=couleur, state="hidden") - self.set_item(item) - self.__rx = rx - self.__ry = ry - - def __str__(self): - return f"Ellipse de centre {self.x},{self.y} et de rayons {self.__rx}x{self.__ry}" - - def get_dim(self): - return self.__rx, self.__ry - - def set_dim(self, rx, ry): - self.__rx = rx - self.__ry = ry - - def contient_point(self, x, y): - return ((x - self.x) / self.__rx) ** 2 + ((y - self.y) / self.__ry) ** 2 <= 1 - - def redimension_par_points(self, x0, y0, x1, y1): - self.x = (x0 + x1) // 2 - self.y = (y0 + y1) // 2 - self.__rx = abs(x0 - x1) / 2 - self.__ry = abs(y0 - y1) / 2 diff --git a/TD5/correction/code/mots.txt b/TD5/correction/code/mots.txt deleted file mode 100755 index d52bfc54f030dd8bd536ddcd25dac998e436aa91..0000000000000000000000000000000000000000 --- a/TD5/correction/code/mots.txt +++ /dev/null @@ -1,835 +0,0 @@ -ABIME -ABSENT -ACCIDENT -ACCROCHER -ACROBATE -ADROIT -AEROPORT -AFFAIRE -AFFICHE -AGITER -AIDER -AIGUILLE -ALBUM -ALLER -ALPHABET -AMENER -AMI -AMPOULE -AMUSANT -AMUSER -ANCIEN -ANGLE -ANORAK -APPAREIL -APPEL -APPORTER -APPUYER -APPUYER -APRES -ARC -ARMOIRE -ARRACHER -ARRET -ARRETER -ARRIERE -ARRIVER -ARROSER -ARROSOIR -ASSIETTE -ASSIS -ATTACHER -ATTENDRE -ATTENTION -ATTERRIR -ATTRAPER -AUTANT -AUTOUR -AVANCER -AVANT -AVION -BAGAGE -BAGARRE -BAGARRER -BAGUETTE -BAIGNER -BAILLER -BAISSER -BALANCER -BALANCOIRE -BALLE -BALLON -BANC -BANDE -BARBE -BARBOTER -BARRE -BARREAU -BAS -BATEAU -BATTRE -BEAUCOUP -BIBLIOTHEQUE -BICYCLETTE -BIEN -BILLE -BLANC -BLEU -BLOND -BOIS -BOITE -BOITE -BONDIR -BONNET -BORD -BOTTE -BOUCHER -BOUCHON -BOUDER -BOUGER -BOUSCULER -BOUT -BOUTEILLE -BOUTON -BRAS -BRETELLE -BRICOLAGE -BRUIT -BRUN -BULLES -BUREAU -CABANE -CABINET -CACHER -CAGE -CAGOULE -CAHIER -CAISSE -CALME -CAMARADE -CAMESCOPE -CAMION -CANARD -CARNET -CARRE -CARREAU -CARTABLE -CARTE -CARTON -CARTON -CASIER -CASQUE -CASQUETTE -CASSE -CASSER -CASSEROLE -CASSETTE -CATALOGUE -CEINTURE -CERCEAU -CERF -CHAINE -CHAISE -CHAISE -CHANGER -CHANSON -CHANTER -CHAPEAU -CHARGER -CHATEAU -CHAUD -CHAUSSER -CHAUSSETTE -CHAUSSON -CHAUSSURE -CHEMISE -CHERCHER -CHEVILLE -CHIFFRE -CHOISIR -CHOSE -CHUCHOTER -CHUTE -CIGARETTE -CINQ -CISEAUX -CLAIR -CLASSE -CLEF -CLOU -COEUR -COGNER -COIN -COL -COLERE -COLLANT -COLLE -COLLE -COLLER -COLORIAGE -COLORIER -COMMENCER -COMPARER -COMPTER -CONDUIRE -CONSTRUIRE -CONTE -CONTINUER -CONTRAIRE -CONTRE -COPAIN -COPIER -COQUIN -CORDE -CORPS -COTE -COU -COUCHER -COUDE -COUDRE -COULER -COULEUR -COULOIR -COUP -COUPER -COUR -COURIR -COURONNE -COURSE -COURT -COUVRIR -CRACHER -CRAIE -CRAVATE -CRAYON -CREUSER -CRIER -CROCHET -CROCODILE -CUBE -CUILLERE -CUISSE -CULOTTE -CURIEUX -CUVETTE -DAME -DANGER -DANGEUREUX -DANS -DANSER -DE -DEBORDER -DEBOUT -DEBOUT -DECHIRER -DECOLLER -DECORER -DECOUPAGE -DECOUPER -DEDANS -DEFENDRE -DEGONFLER -DEGUISER -DEHORS -DEMARRER -DEMOLIR -DEPASSER -DERNIER -DERRIERE -DESCENDRE -DESHABILLER -DESOBEIR -DESSIN -DESSINER -DESSUS -DETRUIRE -DEUX -DEUXIEME -DEVANT -DICTIONNAIRE -DIFFERENCE -DIFFERENT -DIFFICILE -DIRE -DIRECTEUR -DIRECTRICE -DISCUTER -DISPARAITRE -DISPUTE -DISTRIBUER -DIX -DOIGT -DOIGTS -DOMINO -DONNER -DORMIR -DOS -DOSSIER -DOUCHE -DOUCHER -DOUX -DROIT -DROITE -DU -DUR -EAU -EAU -ECARTER -ECHANGER -ECHARPE -ECHASSE -ECHASSES -ECHELLE -ECLABOUSSER -ECLAIRER -ECOLE -ECORCHER -ECOUTER -ECRAN -ECRASER -ECRIRE -ECRITURE -ECUREUIL -EFFACER -EFFORT -ELASTIQUE -ELEVE -EMMENER -EMPECHER -EMPORTER -ENCORE -ENERVER -ENFANT -ENFILER -ENFONCER -ENGIN -ENLEVER -ENSEMBLE -ENTENDRE -ENTONNOIR -ENTOURER -ENTRER -ENTRER -ENVELOPPE -ENVOLER -ENVOYER -ENVOYER -EPAIS -EPAULE -EPEE -EQUILIBRE -EQUIPE -ESCABEAU -ESCALADE -ESCALADER -ESCALIER -ESSUYER -ETAGERE -ETIQUETTE -ETROIT -EXPLIQUER -EXPLIQUER -EXTERIEUR -FABRIQUER -FACE -FACILE -FAIRE -FATIGUE -FAUTE -FEE -FENETRE -FERMER -FESSE -FEU -FEUILLE -FEUTRE -FICELLE -FIL -FILE -FILET -FILLE -FILM -FINIR -FLAQUE -FLECHE -FLOTTER -FOI -FOIS -FONCE -FOND -FORME -FORT -FOU -FOUILLER -FRAPPER -FREIN -FROID -FUSEE -FUSIL -GAGNER -GALOPER -GANT -GARAGE -GARCON -GARDER -GARDIEN -GARE -GARER -GAUCHE -GENER -GENOU -GENTIL -GLISSER -GOMME -GONFLER -GOUTER -GOUTTES -GRAND -GRIMPER -GRIS -GRONDER -GROS -GROUPE -GRUE -GYMNASTIQUE -HABILLER -HABIT -HANCHE -HANDICAPE -HAUT -HELICOPTERE -HISTOIRE -HUIT -HUMIDE -HURLER -ICI -IDEE -IMAGE -IMITER -IMMOBILE -INONDER -INSEPARABLE -INSTALLER -INSTRUMENT -INTERESSANT -INTERIEUR -INTRUS -JALOUX -JAMAIS -JAMBE -JAUNE -JEAN -JEU -JEU -JOLI -JONGLER -JOUER -JOUET -JOUEUR -JUPE -LACER -LACET -LAINE -LAISSER -LANCER -LARGE -LAVABO -LAVER -LETTRE -LEVER -LIGNE -LINGE -LIRE -LISSE -LISTE -LIT -LITRE -LIVRE -LOIN -LONG -LUNETTES -MADAME -MAGAZINE -MAGICIEN -MAGIE -MAGNETOSCOPE -MAILLOT -MAIN -MAINS -MAITRE -MAITRESSE -MAL -MALADROIT -MANCHE -MANQUER -MANTEAU -MARCHE -MARCHER -MARIONNETTE -MARTEAU -MATELAS -MATERNELLE -MECHANT -MELANGER -MEME -MENSONGE -MESURER -METAL -METRE -METTRE -MEUBLE -MICRO -MIEUX -MILIEU -MINE -MODELE -MODELER -MOINS -MOITIE -MONTAGNE -MONTER -MONTRER -MONTRER -MORCEAU -MOT -MOTEUR -MOTO -MOUCHOIR -MOUFLE -MOUILLE -MOUILLER -MOULIN -MOUSSE -MOYEN -MUET -MULTICOLORE -MUR -MUR -MUSCLE -MUSIQUE -NAGER -NEUF -NOEUD -NOIR -NOM -NOMBRE -NOUVEAU -NU -NUMERO -OBEIR -OBJET -OBLIGER -ONGLE -ORCHESTRE -ORDINATEUR -ORDRE -OUTIL -OUVRIR -OUVRIR -PAGE -PAIRE -PAIX -PANNE -PANTALON -PAPIER -PARCOURS -PARDON -PAREIL -PARKING -PARLER -PARTAGER -PARTIE -PARTIR -PARTIR -PAS -PASSERELLE -PATE -PATTES -PEDALE -PEDALER -PEINDRE -PEINTURE -PEINTURE -PELLE -PELUCHE -PENCHER -PENTE -PERCER -PERCHER -PERDRE -PERLE -PERSONNE -PETIT -PEU -PEUR -PHOTO -PIED -PIED -PILOTE -PINCEAU -PINCEAU -PINCER -PION -PIROUETTE -PLACARD -PLAFOND -PLAINDRE -PLANCHE -PLASTIQUE -PLATRE -PLEURER -PLEUVOIR -PLI -PLIAGE -PLIER -PLONGEOIR -PLONGER -PLUIE -PLUS -PNEU -POCHE -POIGNET -POING -POINT -POINTU -POISSON -POLI -POMPE -PONT -PONT -PORTE -PORTER -POSER -POSER -POSTER -POT -POUBELLE -POUCE -POURSUIVRE -POUSSER -POUTRE -POUVOIR -PREAU -PREMIER -PRENDRE -PRENOM -PREPARER -PRES -PRESENT -PRESQUE -PRESSER -PRESSER -PRETER -PRINCE -PRISE -PRIVER -PROGRES -PROGRESSER -PROMETTRE -PROPRE -PROTEGER -PUNIR -PUZZLE -PYJAMA -QUAI -QUATRE -QUESTION -QUITTER -RACONTER -RADIATEUR -RADIO -RAMPE -RAMPER -RANG -RANGER -RAQUETTE -RATER -RAYON -RAYURE -RECEVOIR -RECHAUFFER -RECITER -RECOMMENCER -RECREATION -RECULER -REFUSER -REGARDER -REINE -REMETTRE -REMPLACER -REMPLIR -RENVERSER -REPARER -REPETER -REPONDRE -RESPIRER -RESSEMBLER -RESTER -RETARD -RETOURNER -REUSSIR -REVENIR -RIDEAU -RIVIERE -ROBE -ROBINET -ROI -ROND -ROND -ROUE -ROUGE -ROULADE -ROULER -ROUX -RUBAN -SABLE -SAC -SAGE -SAIGNER -SALADIER -SALE -SALIR -SALLE -SALON -SAUT -SAUTER -SCIE -SEAU -SEC -SECHER -SEMELLE -SENS -SENTIR -SEPARER -SEPT -SERIEUX -SERPENT -SERRE -SERRER -SERRURE -SERVIETTE -SERVIR -SEUL -SIEGE -SIESTE -SIFFLER -SIFFLET -SIGNE -SIGNE -SILENCE -SINGE -SIX -SOCIERE -SOL -SOLDAT -SOLIDE -SOMMEIL -SONNER -SONNETTE -SORTIE -SORTIR -SOUFFLER -SOULEVER -SOULIGNER -SOUPLE -SOURD -SOURIRE -SOUS -SOUVENT -SPORT -STYLO -SUIVANT -SUIVRE -SUR -SURVEILLER -TABLE -TABLEAU -TABLIER -TABOURET -TACHE -TAILLE -TAILLER -TALON -TAMBOUR -TAMPON -TAPER -TAPIS -TARD -TAS -TASSE -TELECOMMANDE -TELEPHONE -TELEVISION -TENDRE -TENIR -TERMINER -TETE -TIRER -TIROIR -TISSU -TITRE -TOBOGGAN -TOILETTE -TOMBER -TORDU -TOT -TOUCHER -TOUJOURS -TOUR -TOURNER -TOURNEVIS -TRAIN -TRAINER -TRAIT -TRAMPOLINE -TRANQUILLE -TRANSPARENT -TRANSPIRER -TRANSPORTER -TRAVAIL -TRAVAILLER -TRAVERSER -TREMPER -TRICOT -TRICYCLE -TRIER -TROIS -TROISIEME -TROMPETTE -TROP -TROUER -TROUS -TROUSSE -TROUVER -TROUVER -TUNNEL -TUYAU -UN -UNIFORME -USE -VALISE -VELO -VENIR -VENTRE -VERRE -VERS -VERSER -VERT -VESTE -VETEMENT -VIDER -VIRAGE -VIS -VITE -VITESSE -VITRE -VOITURE -VOIX -VOLANT -VOLER -VOULOIR -VOYAGE -WAGON -XYLOPHONE -ZERO -ZIGZAG diff --git a/TD5/correction/code/pendu.py b/TD5/correction/code/pendu.py deleted file mode 100644 index a86e71c43a0842906c9ae987094497e8d3ced1b3..0000000000000000000000000000000000000000 --- a/TD5/correction/code/pendu.py +++ /dev/null @@ -1,156 +0,0 @@ -#pendu5.py -from tkinter import * -from random import randint -from formes import * - -class ZoneAffichage(Canvas): - def __init__(self, parent, w, h, c): - - Canvas.__init__(self, master=parent, width=w, height=h, bg=c) - - # Listes des formes du pendu, dans l'ordre du dessin - self.__listeShape = [] - - # Base, Poteau, Traverse, Corde - self.__listeShape.append(Rectangle(self, 50, 270, 200, 26, "brown")) - self.__listeShape.append(Rectangle(self, 87, 83, 26, 200, "brown")) - self.__listeShape.append(Rectangle(self, 87, 70, 150, 26, "brown")) - self.__listeShape.append(Rectangle(self, 183, 67, 10, 40, "brown")) - # Tete, Tronc - self.__listeShape.append(Ellipse(self, 188, 120, 20, 20, "black")) - self.__listeShape.append(Rectangle(self, 175, 143, 26, 60, "black")) - # Bras gauche, droit - self.__listeShape.append(Rectangle(self, 133, 150, 40, 10, "black")) - self.__listeShape.append(Rectangle(self, 203, 150, 40, 10, "black")) - # Jambes gauche et droite - self.__listeShape.append(Rectangle(self, 175, 205, 10, 40, "black")) - self.__listeShape.append(Rectangle(self, 191, 205, 10, 40, "black")) - - def cachePendu(self): - for i in range(len(self.__listeShape)): - self.__listeShape[i-1].set_state("hidden") - - def dessinePiecePendu(self, i): - if i<=len(self.__listeShape): - self.__listeShape[i-1].set_state("normal") - -class MonBoutonLettre(Button): - def __init__(self, parent, fen, t): - Button.__init__(self, master=parent, text=t, state=DISABLED) - self.__fen=fen - self.__lettre=t - - def cliquer(self): - self.config(state=DISABLED) - self.__fen.traitement(self.__lettre) - - -class FenPrincipale(Tk): - def __init__(self): - Tk.__init__(self) - self.title('Jeu du pendu') - self.configure(bg="#2687bc") - - # La barre d'outils - barreOutils = Frame(self) - barreOutils.pack(side=TOP, padx=5, pady=5) - newGameButton = Button(barreOutils, text ='Nouvelle partie', width=13) - newGameButton.pack(side=LEFT, padx=5, pady=5) - quitButton = Button(barreOutils, text ='Quitter', width=13) - quitButton.pack(side=LEFT, padx=5, pady=5) - - # Le canvas pour le dessin du pendu - self.__zoneAffichage = ZoneAffichage(self, 320, 320, "#ec4062") - self.__zoneAffichage.pack(side=TOP, padx=5, pady=5) - - # Le mot à deviner - self.__lmot = Label(self, text='Mot :') - self.__lmot.pack(side=TOP) - - # Le clavier - clavier = Frame(self) - clavier.pack(side=TOP, padx=5, pady=5) - self.__boutons = [] - for i in range(26): - t = chr(ord('A')+i) - self.__boutons.append(MonBoutonLettre(clavier, self, t)) - - # Placement des boutons du clavier - for i in range(3): - for j in range(7): - self.__boutons[i*7+j].grid(row=i,column=j) - for j in range(5): - self.__boutons[21+j].grid(row=3,column=j+1) - - # Commandes associées aux boutons - quitButton.config(command=self.destroy) - newGameButton.config(command=self.nouvellePartie) - for i in range(26): - self.__boutons[i].config(command=self.__boutons[i].cliquer) - - # initialisation des attributs - self.__mot = "" - self.__motAffiche= "" - self.__mots= [] - self.__nbManques = 0 - - # Chargement du fichier de mots - self.chargeMots() - - # On commence une nouvelle partie - self.nouvellePartie() - - def chargeMots(self): - f = open('mots.txt', 'r') - s = f.read() - self.__mots = s.split('\n') - f.close() - - def nouvellePartie(self): - - # Boutons-lettres dégrisés - for i in range(26): - self.__boutons[i].config(state=NORMAL) - - # Nouveau mot à devnier et update - self.__mot = self.__mots[randint(0,len(self.__mots)-1)] - self.__motAffiche = len(self.__mot)*'*' - self.__lmot.config(text='Mot : '+self.__motAffiche) - - # on re-init le nbre de coups manqués et on efface le précédent dessin - self.__nbManques = 0 - self.__zoneAffichage.cachePendu() #---> on cache le pendu en utilisant la couleur de fond - - def traitement(self, lettre): - cpt = 0 - lettres = list(self.__motAffiche) - for i in range(len(self.__mot)): - if self.__mot[i]==lettre: - cpt +=1 - lettres[i]=lettre - - self.__motAffiche = ''.join(lettres) - - if cpt ==0: - self.__nbManques += 1 - self.__zoneAffichage.dessinePiecePendu(self.__nbManques) #---> Dessin de l'elt suivant - if self.__nbManques >= 10: - self.finPartie(False) - else: - self.__lmot.config(text='Mot : '+self.__motAffiche) - if self.__mot == self.__motAffiche: - self.finPartie(True) - - def finPartie(self, gagne): - for b in self.__boutons: - b.config(state=DISABLED) - - if gagne : - self.__lmot.config(text=self.__mot+' - Bravo, vous avez gagné') - else : - self.__lmot.config(text='Vous avez perdu, le mot était : '+self.__mot) - - -if __name__ == '__main__': - fen = FenPrincipale() - fen.mainloop() diff --git a/TD5/correction/diagramme_classes_pendu.png b/TD5/correction/diagramme_classes_pendu.png deleted file mode 100644 index 78a06339ad5447869fa96f0dbdd0d5fbd2c248a9..0000000000000000000000000000000000000000 Binary files a/TD5/correction/diagramme_classes_pendu.png and /dev/null differ