From 900478505764f3913ac109bc49932475d49478de Mon Sep 17 00:00:00 2001
From: Loris TICHADOU <loris.tichadou@ensiie.fr>
Date: Thu, 22 Aug 2019 08:49:23 +0200
Subject: [PATCH] des idiots partout

---
 .gitignore   |   1 +
 nardco.py    | 315 +++++++++++++++++++++++++--------------------------
 philotron.py | 160 +++++++++++++-------------
 3 files changed, 234 insertions(+), 242 deletions(-)

diff --git a/.gitignore b/.gitignore
index dcfdc53..6b8eeb6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
 .idea
 canaux_reddit.txt
 praw.ini
+config.py
diff --git a/nardco.py b/nardco.py
index 448e7af..af6a41f 100755
--- a/nardco.py
+++ b/nardco.py
@@ -17,13 +17,17 @@ import codage
 import nordpresse
 import commit
 import kohlanta
-from  ensiee import ensiee
+from ensiee import ensiee
 from quizz import quizz
 from useless import useless
 from haddock import haddock
 from manger import is_l_heure_de_manger, should_ban
 from bdsm import bdsm
+
+import config
 # import rateau
+
+
 def couper(pseudo):
     return pseudo.split("!")[0]
 
@@ -47,6 +51,7 @@ def aram():
              " Zyra"]
     return Champ[random.randint(0, len(Champ) - 1)]
 
+
 last_args = None
 last_cmd = None
 global pour
@@ -55,33 +60,30 @@ global suple
 suple = -1
 
 
-
-global cmdCarac
-cmdCarac = "$"
-
 personnalizedCmd = {}
 
 
-reponse = None 
+reponse = None
 pas_reponse = []
 a_repondu = []
 scores = {}
-tour = 0 
+tour = 0
 total = 0
 
+
 def isCommande(string):
-    global cmdCarac
-    return string[0] == cmdCarac
+    return string[0] == config.cmdCarac
+
 
-def no_hl(pseudo) :
+def no_hl(pseudo):
     ins = u'\u200C'.encode("utf-8")
     return pseudo[0] + str(ins) + pseudo[1:]
 
 
-
 class Boooob(ircbot.SingleServerIRCBot):
     def __init__(self):
-        ircbot.SingleServerIRCBot.__init__(self, [("irc.iiens.net", 6667)], "nardco", "Je suis un bot")
+        ircbot.SingleServerIRCBot.__init__(
+            self, [("irc.iiens.net", 6667)], config.nick, "Je suis un bot")
         self.temps = 0
         self.reddit_temps = 0
         self.fichier_reddit = "canaux_reddit.txt"
@@ -93,7 +95,8 @@ class Boooob(ircbot.SingleServerIRCBot):
         serv.join("#fokontest")
         serv.join("#Titch")
         # serv.join("#gynecoloc")
-        serv.privmsg("NickServ", "IDENTIFY MotDePasse")  # rejoint #nardco à sa connexion
+        serv.privmsg("NickServ", "IDENTIFY {0}".format(
+            config.password))  # rejoint #nardco à sa connexion
 
     #
     def on_join(self, serv, ev):  # Quand qq entre dans le chann, le bot inclus
@@ -104,28 +107,23 @@ class Boooob(ircbot.SingleServerIRCBot):
         personne = ev.source()
         canal = ev.arguments()[0]
         serv.privmsg("Titch", couper(personne) + " m'a invité sur " + canal)
-        
 
     def on_kick(self, serv, ev):
-        serv.join("#nardco")
-        print("kick")
         personne = ev.source()
         personne = couper(personne)
         canal = ev.target()
-        if canal == "#Titch" and personne != "Titch" :
+        if canal == "#Titch" and personne != "Titch":
             serv.mode(canal, "-o " + personne)
 
-
     def on_pubmsg(self, serv, ev):  # quand qq ecrit dans le chat
         global suple
-        global cmdCarac
         global personnalizedCmd
         global last_args
         global last_cmd
         global reponse
         global a_repondu
         global pas_reponse
-        global tour 
+        global tour
         global scores
         global total
 
@@ -136,20 +134,20 @@ class Boooob(ircbot.SingleServerIRCBot):
         message = ev.arguments()[0]
         message = message.lower()  # Passe le message en minuscules
         split = message.split(" ")
-        if "op pls" in message or "op plz" in message :
+        if "op pls" in message or "op plz" in message:
             serv.mode(canal, "+o "+personne)
-        if 'nardco' in split[0] and ' ou ' in message :
+        if config.nick in split[0] and ' ou ' in message:
             splt = split[1:]
             idx = splt.index("ou")
-            choice = random.randint(0,1)
-            if choice == 0 :
-                    res = splt[:idx]
-            else :
-                if '?' in splt[-1] :
+            choice = random.randint(0, 1)
+            if choice == 0:
+                res = splt[:idx]
+            else:
+                if '?' in splt[-1]:
                     res = splt[idx+1:-1]
-                else :
+                else:
                     res = splt[idx+1:]
-            serv.privmsg(canal, ' '.join(res)+ "!")
+            serv.privmsg(canal, ' '.join(res) + "!")
 
         # lol of legends
         if " aram " in message:
@@ -183,97 +181,91 @@ class Boooob(ircbot.SingleServerIRCBot):
             if "aucun lien" in message:
                 serv.privmsg(canal, "Je suis fils unique...")
 
-
-
-
                 # fonctions de deplacement dans les chann
 
-        if "Titch" in personne and "goto" in message and "nardco" in message:
+        if "Titch" in personne and "goto" in message and config.nick in message:
             f = 0
             for f in range(len(message) - 4):
                 if message[f:f + 4] == "goto":
                     serv.join("#" + message[f + 5:])
                     break
-        if "Titch" in personne and "leave" in message and "nardco" in message:
+        if "Titch" in personne and "leave" in message and config.nick in message:
             serv.part(canal)
 
-        if reponse is not None : 
-            if  fuzz.ratio(message, reponse) > 60  and personne not in a_repondu: 
-                serv.privmsg(canal, personne + " a trouvé la reponse : {0} ! Bien joué !".format(reponse))
+        if reponse is not None:
+            if fuzz.ratio(message, reponse) > 60 and personne not in a_repondu:
+                serv.privmsg(canal, personne +
+                             " a trouvé la reponse : {0} ! Bien joué !".format(reponse))
                 reponse = None
                 a_repondu = []
                 pas_reponse = []
-                tour+=1
-                if personne in scores.keys() :
-                    scores[personne]+=1
-                else :
+                tour += 1
+                if personne in scores.keys():
+                    scores[personne] += 1
+                else:
                     scores[personne] = 1
-                
-                if tour == total : 
+
+                if tour == total:
                     maxScore = 0
                     gagnant = ''
-                    
-                    for pseudo in scores.keys() : 
-                        if scores[pseudo] > maxScore : 
+
+                    for pseudo in scores.keys():
+                        if scores[pseudo] > maxScore:
                             maxScore = scores[pseudo]
-                            gagnant = pseudo 
-                    serv.privmsg(canal, "{0} a gagné avec un score de {1}".format(gagnant, maxScore))
+                            gagnant = pseudo
+                    serv.privmsg(
+                        canal, "{0} a gagné avec un score de {1}".format(gagnant, maxScore))
                     scores = {}
-                    tour = 0 
+                    tour = 0
                     total = 0
-                else : 
+                else:
                     datas = quizz()
                     reponse = datas['reponse'].lower()
                     choix = datas['choix']
-                    question= datas['question']
+                    question = datas['question']
                     pas_reponse = datas['pas_reponse']
                     serv.privmsg(canal, "Question : {0}".format(question.format('utf8')))
                     serv.privmsg(canal, "Choix: {0}".format(', '.join(choix).format('utf8')))
-            else : 
-                print pas_reponse
-                print message
-                for mot in pas_reponse : 
-                    if mot.lower() in message and not (personne in a_repondu) :
+            else:
+                for mot in pas_reponse:
+                    if mot.lower() in message and not (personne in a_repondu):
                         serv.privmsg(canal, "WRONG, {0}".format(personne))
                         a_repondu.append(personne)
-            
 
-        if not is_l_heure_de_manger() and should_ban(message) :
+        if not is_l_heure_de_manger() and should_ban(message):
             serv.privmsg(canal, "PUTAIN ON A DIT NON")
 
-
             # REDDIT // A COMPLETER
         if isCommande(message):
             serv.privmsg("Titch", "{0} : {1}".format(personne, message))
             args = message[1:].split(" ")
             cmd = args[0]
-            if cmd == "!!" and last_args and last_cmd : 
+            if cmd == "!!" and last_args and last_cmd:
                 args = last_args
                 cmd = last_cmd
-            if cmd == "!" and last_cmd :
+            if cmd == "!" and last_cmd:
                 cmd = last_cmd
-            
-            if len(args) > 1 and args[1] == "!" : 
+
+            if len(args) > 1 and args[1] == "!":
                 args = last_args
 
-            last_args = args 
+            last_args = args
             last_cmd = cmd
 
-            cmds = ['help', 'bdsm', 'haddock', 'useless', 'quizz', 'ecole', 'ffs', 'thanos', 'chuck', 'roll', 'rateau', 'viieux', 'kohlanta', 'new', 'del', 'get', 'debat', 'pipo', 'np', 'commit', 'zertyu', 'getsub', 'sub', 'delsub', 'addsub', 'reddit']
+            cmds = ['help', 'bdsm', 'haddock', 'useless', 'quizz', 'ecole', 'ffs', 'thanos', 'chuck', 'roll', 'rateau', 'viieux',
+                    'kohlanta', 'new', 'del', 'get', 'debat', 'pipo', 'np', 'commit', 'zertyu', 'getsub', 'sub', 'delsub', 'addsub', 'reddit']
 
             most_likely = (cmd, 0)
-            if cmd not in cmds : 
+            if cmd not in cmds:
 
-                for f in cmds : 
+                for f in cmds:
                     ratio = fuzz.ratio(cmd, f)
-                    if ratio > 60 and ratio > most_likely[1] : 
+                    if ratio > 60 and ratio > most_likely[1]:
                         most_likely = (f, ratio)
                 cmd = most_likely[0]
-            
-            if 'spoil' in args or 'spoil' in cmd : 
+
+            if 'spoil' in args or 'spoil' in cmd:
                 serv.privmsg(canal, "Le risque de spoil est present. je fais pas ça.")
-            
-            
 
             elif cmd == "help":
                 if len(message.split(" ")) > 1:
@@ -281,171 +273,169 @@ class Boooob(ircbot.SingleServerIRCBot):
                         serv.privmsg(
                             canal,
                             ("Commandes : "
-                            "{0}reddit <sub> ; "
-                            "{0}addsub <sub> ; "
-                            "{0}delsub <sub> ; "
-                            "{0}getsub ."
-                            "(getsub renvoie des infos sur "
-                            "tous les subs enregistrés pour le chann) ").format(cmdCarac))
+                             "{0}reddit <sub> ; "
+                             "{0}addsub <sub> ; "
+                             "{0}delsub <sub> ; "
+                             "{0}getsub ."
+                             "(getsub renvoie des infos sur "
+                             "tous les subs enregistrés pour le chann) ").format(config.cmdCarac))
                 else:
                     serv.privmsg(canal,
                                  ("Commandes disponibles :{0}").format(', '.join(cmds)))
-                
+
             elif cmd == "haddock":
                 serv.privmsg(canal, haddock())
-            elif cmd == "bdsm" : 
+            elif cmd == "bdsm":
                 liste = self.channels[canal].users()
                 chosen = liste[random.randint(0, len(liste) - 1)]
                 c = 0
-                while personne in chosen and c < 10 :
+                while personne in chosen and c < 10:
                     chosen = liste[random.randint(0, len(liste) - 1)]
-                    c+=1
-                if chosen[0] in ["~", "&", "@", "%", "+"] :
+                    c += 1
+                if chosen[0] in ["~", "&", "@", "%", "+"]:
                     chosen = chosen[1:]
                 serv.privmsg(canal, bdsm(personne, chosen))
 
+            elif cmd == "quizz":
 
-            elif cmd == "quizz" : 
-
-                if len(args)> 1 : 
-                    if int(args[1]) :
+                if len(args) > 1:
+                    if int(args[1]):
                         total = int(args[1])
-                    else :
+                    else:
                         total = 10
-                else : 
+                else:
                     total = 10
-                serv.privmsg(canal, "{0} a commencé un quizz ! Jouez ! {1} questions ! ".format(personne, total))
+                serv.privmsg(
+                    canal, "{0} a commencé un quizz ! Jouez ! {1} questions ! ".format(personne, total))
                 datas = quizz()
                 reponse = datas['reponse'].lower()
                 choix = datas['choix']
-                question= datas['question']
+                question = datas['question']
                 pas_reponse = datas['pas_reponse']
                 serv.privmsg(canal, "Question : {0}".format(question.format('utf8')))
                 serv.privmsg(canal, "Choix: {0}".format(', '.join(choix).format('utf8')))
-            elif cmd == "useless" :
+            elif cmd == "useless":
                 serv.privmsg(canal, useless())
-            elif cmd == "ecole" : 
-                try :
-                    
-                    if len(args) > 1 : 
-                        serv.privmsg(canal, "Oui, vous êtes bien à l'{}".format(ensiee(''.join(args[1:]))))
-                    else :
+            elif cmd == "ecole":
+                try:
+
+                    if len(args) > 1:
+                        serv.privmsg(canal, "Oui, vous êtes bien à l'{}".format(
+                            ensiee(''.join(args[1:]))))
+                    else:
                         serv.privmsg(canal, "Oui, vous êtes bien à l'{}".format(ensiee()))
-                except :
+                except:
                     pass
-                
-            elif cmd == "ffs" :
-                serv.privmsg(canal, "Nom de Dieu de putain de bordel de merde de saloperie de connard d'enculé de ta mère")
-            elif cmd == "chuck" :
-                try :
+
+            elif cmd == "ffs":
+                serv.privmsg(
+                    canal, "Nom de Dieu de putain de bordel de merde de saloperie de connard d'enculé de ta mère")
+            elif cmd == "chuck":
+                try:
                     parser = HTMLParser()
                     r = requests.get("http://www.chucknorrisfacts.fr/api/get?data=tri:alea;nb:1")
                     rep = r.json()[0]['fact']
                     rep = parser.unescape(rep)
-                    print(rep)
                     serv.privmsg(canal, rep.encode('utf8'))
-                except Exception  :
-                    print str(Exception)
+                except Exception:
                     serv.privmsg(canal, "erreur :(")
-            elif cmd == "thanos" and personne == "Titch"  :
+            elif cmd == "thanos" and personne == "Titch":
                 liste = self.channels[canal].users()
                 random.shuffle(liste)
                 serv.privmsg(canal, "snap ! ")
                 cleanlist = []
-                for f in liste :
-                    if f[0] in ["~", "&", "@", "%", "+"] and 'nardco' not in f :
+                for f in liste:
+                    if f[0] in ["~", "&", "@", "%", "+"] and config.nick not in f:
                         cleanlist.append(no_hl(f))
-                    elif 'nardco' not in f :
+                    elif config.nick not in f:
                         cleanlist.append(no_hl(f))
                 live = cleanlist[:len(liste)//2]
-                dead = cleanlist[len(liste)//2 + 1 :]
-                pp = dead[random.randint(0,len(dead) - 1)]
-                ts = live[random.randint(0,len(live) - 1)]
+                dead = cleanlist[len(liste)//2 + 1:]
+                pp = dead[random.randint(0, len(dead) - 1)]
+                ts = live[random.randint(0, len(live) - 1)]
                 serv.nick('{0}_'.format(pp))
                 serv.privmsg(canal, "I don't feel so good mr {0}".format(ts))
-                serv.nick('nardco')
+                serv.nick(config.nick)
                 live_ = []
                 dead_ = []
-                for f in live :
+                for f in live:
                     live_.append(no_hl(f))
-                for f in dead :
+                for f in dead:
                     dead_.append(no_hl(f))
-                serv.privmsg(canal, "Vivants : {0}".format(", ".join(live_) ))
-                serv.privmsg(canal, "Morts : {0}".format(", ".join(dead_) ))
+                serv.privmsg(canal, "Vivants : {0}".format(", ".join(live_)))
+                serv.privmsg(canal, "Morts : {0}".format(", ".join(dead_)))
                 #serv.mode(canal, "+" + len(live)*'v' + " "+" ".join(live))
                 #serv.mode(canal, "+m")
 
             elif cmd == "roll" and len(split) > 1:
                 content = split[1]
-                if len(content.split('d')) == 2 :
+                if len(content.split('d')) == 2:
                     nbrDe = content.split('d')[0]
                     valDe = content.split('d')[1]
                     print(content, nbrDe, valDe)
                     res = ""
-                    try :
-                        for f in range(int(nbrDe)) :
-                            res = res + " {} ".format(random.randint(1,int(valDe)))
+                    try:
+                        for f in range(int(nbrDe)):
+                            res = res + " {} ".format(random.randint(1, int(valDe)))
                         serv.privmsg(canal, res)
-                    except :
+                    except:
                         pass
 
-            elif cmd == "rateau" :
+            elif cmd == "rateau":
                 serv.privmsg(canal, "{0} : {1}".format(personne, rateau.getRateau()))
-                
-            elif cmd == "viieux" : 
+
+            elif cmd == "viieux":
                 serv.privmsg(canal, viieux.get_viieux())
 
-            elif cmd == "kohlanta" : 
-                if (len(args) > 1 ) :
+            elif cmd == "kohlanta":
+                if (len(args) > 1):
                     serv.privmsg(canal, kohlanta.kohlanta(args[1], canal))
 
-            elif cmd == "new" :
-                if len(args)>1 :
-                    if args[1] in personnalizedCmd.keys() :
+            elif cmd == "new":
+                if len(args) > 1:
+                    if args[1] in personnalizedCmd.keys():
                         serv.privmsg(canal, 'commande deja existante')
-                    else :
+                    else:
                         newCmd = {}
                         newCmd['result'] = ' '.join(args[2:])
                         newCmd['author'] = personne
                         newCmd['channel'] = canal
                         personnalizedCmd[args[1]] = newCmd
-                        print personnalizedCmd
-                        serv.privmsg(canal, 'commande ajoutée : ${0}, par {1}, pour le chann {2}'.format(args[1], personne, canal))
-            elif cmd == "del" :
-                if len(args) > 1 :
-                    if args[1] in personnalizedCmd.keys() :
-                        if personne == personnalizedCmd[args[1]]['author'] :
+                        serv.privmsg(canal, 'commande ajoutée : ${0}, par {1}, pour le chann {2}'.format(
+                            args[1], personne, canal))
+            elif cmd == "del":
+                if len(args) > 1:
+                    if args[1] in personnalizedCmd.keys():
+                        if personne == personnalizedCmd[args[1]]['author']:
                             del personnalizedCmd[args[1]]
                             serv.privmsg(canal, 'done')
-                        else :
+                        else:
                             serv.privmsg(canal, "vous n'etes pas l'auteur de cette commande !")
-            elif cmd == "get" :
+            elif cmd == "get":
                 res = []
-                for f in personnalizedCmd.keys() :
-                    if personnalizedCmd[f]["channel"] == canal :
+                for f in personnalizedCmd.keys():
+                    if personnalizedCmd[f]["channel"] == canal:
                         res.append(f)
                 serv.privmsg(canal, 'commandes pour {0} : {1}'.format(canal, ", ".join(res)))
-                        
 
-            elif cmd == "debat" :
+            elif cmd == "debat":
                 serv.privmsg(canal, philotron.genererSujet())
-            elif cmd == "pipo" :
+            elif cmd == "pipo":
                 serv.privmsg(canal, pipotron.pipo())
 
-            elif cmd == "np" : 
+            elif cmd == "np":
                 res = nordpresse.nordpresse()
                 serv.privmsg(canal, res)
-            elif cmd == "commit" : 
+            elif cmd == "commit":
                 res = commit.commit()
                 serv.privmsg(canal, res)
-            elif cmd == "zertyu" : 
-                if len(args) > 2 :
-                    if args[1] == "code" : 
+            elif cmd == "zertyu":
+                if len(args) > 2:
+                    if args[1] == "code":
                         serv.privmsg(canal, codage.encode(" ".join(args[2:])))
-                    elif args[1] == "decode" :
+                    elif args[1] == "decode":
                         serv.privmsg(canal, codage.decode(" ".join(args[2:])))
 
-
             elif cmd == "getsub":
                 res = red.get_new(self.fichier_reddit, canal)
                 for f in res:
@@ -456,7 +446,8 @@ class Boooob(ircbot.SingleServerIRCBot):
                 for f in bd:
                     try:
                         if canal == f.split("|")[0]:
-                            serv.privmsg(canal, "Liste des subs pour " + canal + " : " + f.split("|")[1])
+                            serv.privmsg(canal, "Liste des subs pour " +
+                                         canal + " : " + f.split("|")[1])
                     except:
                         pass
 
@@ -518,14 +509,14 @@ class Boooob(ircbot.SingleServerIRCBot):
                 else:
                     serv.privmsg(canal, "Subreddit deja dans la bd...")
 
-            elif cmd == "reddit" :
+            elif cmd == "reddit":
                 full = False
-                if len(args) > 1 :
+                if len(args) > 1:
                     sub = args[1]
-                else :
+                else:
                     sub = "jokes"
-                if len(args) > 2 :
-                    if "full" in args[2] :
+                if len(args) > 2:
+                    if "full" in args[2]:
                         full = True
                 if time.time() - self.reddit_temps > 3:
                     self.reddit_temps = time.time()
@@ -545,12 +536,10 @@ class Boooob(ircbot.SingleServerIRCBot):
                         serv.privmsg(canal, "oups, c'est cassé...")
                 else:
                     serv.privmsg(canal, personne + ": Merci de patienter :)")
-            elif cmd in personnalizedCmd.keys() :
-                if personnalizedCmd[cmd]['channel'] == canal :
+            elif cmd in personnalizedCmd.keys():
+                if personnalizedCmd[cmd]['channel'] == canal:
                     serv.privmsg(canal, personnalizedCmd[cmd]['result'])
 
 
-
-
 if __name__ == "__main__":
     Boooob().start()
diff --git a/philotron.py b/philotron.py
index 61a3dde..99f5900 100644
--- a/philotron.py
+++ b/philotron.py
@@ -1,94 +1,96 @@
 # coding:utf8
 import random
 
-def genererSujet() :
-    sujets = [[ "l'oeuvre d'art", "f" ],
-    [ "la réalité", "f" ],
-    [ "l'art", "m" ],
-    [ "l'opinion", "f" ],
-    [ "le pouvoir de refuser", "m" ],
-    [ "le bonheur", "m" ],
-    [ "la liberté", "f" ],
-    [ "le vivant", "m" ],
-    [ "le désir", "m" ],
-    [ "la connaissance", "f" ],
-    [ "la loi", "f" ],
-    [ "l'autre", "m" ],
-    [ "l'homme", "m" ],
-    [ "l'expérience", "f" ],
-    [ "la paix", "f" ],
-    [ "la perception", "f" ],
-    [ "l'objectivité", "f" ],
-    [ "l'impartialité", "f" ],
-    [ "le temps", "m" ],
-    [ "la culture", "f" ],
-    [ "le langage", "m" ],
-    [ "la science", "f" ],
-    [ "l'État", "m" ],
-    [ "la nature", "f" ],
-    [ "la vérité", "f" ],
-    [ "la croyance", "f" ],
-    [ "le travail", "m" ],
-    [ "l'éphémère", "m" ],
-    [ "la justice", "f" ],
-    [ "l'égalité", "f" ]
-    ]
-    structures =  [[ "**1 est-il limité par **2", "**1 est-elle limitée par **2" ],
-    [ "**1 peut-il être **e", "**1 peut-elle être **e" ],
-    [ "**1 peut-il ne pas être **e", "**1 peut-elle ne pas être **e" ],
-    [ "**1 a-t-il des limites", "**1 a-t-elle des limites" ],
-    [ "**1 a-t-il un sens", "**1 a-t-elle un sens" ],
-    [ "**1 est-il avant tout **2", "**1 est-elle avant tout **2" ],
-    [ "**1 est-il capable d'être **e", "**1 est-elle capable d'être **e" ],
-    [ "Faut-il préférer **1 à **2", "Faut-il préférer **1 à **2" ],
-    [ "Que vaut l'opposition de **1 et de **2", "Que vaut l'opposition de **1 et de **2" ],
-    [ "**1 peut-il se satisfaire de **2", "**1 peut-elle se satisfaire de **2" ],
-    [ "La recherche de **1 est-elle **e", "La recherche de **1 est-elle **e" ],
-    [ "**1 transforme-t-il notre conscience de **2", "**1 transforme-t-elle notre conscience de **2" ],
-    [ "Peut-on comprendre **1", "Peut-on comprendre **1" ],
-    [ "**1 peut-il s'éduquer", "**1 peut-elle s'éduquer" ],
-    [ "Peut-on échapper à **1", "Peut-on échapper à **1" ],
-    [ "**1 n'est-il qu'un outil", "**1 n'est-elle qu'un outil" ],
-    [ "**1 se limite-t-il à **2", "**1 se limite-t-elle à **2" ],
-    [ "Que devons-nous à **1", "Que devons-nous à **1" ],
-    [ "**1 nous permet-il de prendre conscience de **2", "**1 nous permet-elle de prendre conscience de **2" ],
-    [ "Devons-nous aspirer à maîtriser **1", "Devons-nous aspirer à maîtriser **1" ],
-    [ "**1 est-il contraire à **2", "**1 est-elle contraire à **2" ],
-    [ "Peut-on vivre sans **1", "Peut-on vivre sans **1" ],
-    [ "Avons-nous le devoir de chercher **1", "Avons-nous le devoir de chercher **1" ],
-    [ "**1 a-t-il de la valeur", "**1 a-t-elle de la valeur" ],
-    [ "**1 rend-t-il **2", "**1 rend-t-elle **2"]
-    ]
 
-    epithetes = [[ "vrai", "vraie" ],
-    [ "beau", "belle" ],
-    [ "raisonnable", "raisonnable" ],
-    [ "universel", "universelle" ],
-    [ "désintéressé", "désintéressée" ],
-    [ "naturel", "naturelle" ],
-    [ "utile", "utile" ],
-    [ "juste", "juste" ],
-    [ "humain", "humaine" ],
-    [ "historique", "historique" ],
-    [ "libre", "libre" ]
-    ]
+def genererSujet():
+    sujets = [["l'oeuvre d'art", "f"],
+              ["la réalité", "f"],
+              ["l'art", "m"],
+              ["l'opinion", "f"],
+              ["le pouvoir de refuser", "m"],
+              ["le bonheur", "m"],
+              ["la liberté", "f"],
+              ["le vivant", "m"],
+              ["le désir", "m"],
+              ["la connaissance", "f"],
+              ["la loi", "f"],
+              ["l'autre", "m"],
+              ["l'homme", "m"],
+              ["l'expérience", "f"],
+              ["la paix", "f"],
+              ["la perception", "f"],
+              ["l'objectivité", "f"],
+              ["l'impartialité", "f"],
+              ["le temps", "m"],
+              ["la culture", "f"],
+              ["le langage", "m"],
+              ["la science", "f"],
+              ["l'État", "m"],
+              ["la nature", "f"],
+              ["la vérité", "f"],
+              ["la croyance", "f"],
+              ["le travail", "m"],
+              ["l'éphémère", "m"],
+              ["la justice", "f"],
+              ["l'égalité", "f"]
+              ]
+    structures = [["**1 est-il limité par **2", "**1 est-elle limitée par **2"],
+                  ["**1 peut-il être **e", "**1 peut-elle être **e"],
+                  ["**1 peut-il ne pas être **e", "**1 peut-elle ne pas être **e"],
+                  ["**1 a-t-il des limites", "**1 a-t-elle des limites"],
+                  ["**1 a-t-il un sens", "**1 a-t-elle un sens"],
+                  ["**1 est-il avant tout **2", "**1 est-elle avant tout **2"],
+                  ["**1 est-il capable d'être **e", "**1 est-elle capable d'être **e"],
+                  ["Faut-il préférer **1 à **2", "Faut-il préférer **1 à **2"],
+                  ["Que vaut l'opposition de **1 et de **2", "Que vaut l'opposition de **1 et de **2"],
+                  ["**1 peut-il se satisfaire de **2", "**1 peut-elle se satisfaire de **2"],
+                  ["La recherche de **1 est-elle **e", "La recherche de **1 est-elle **e"],
+                  ["**1 transforme-t-il notre conscience de **2",
+                      "**1 transforme-t-elle notre conscience de **2"],
+                  ["Peut-on comprendre **1", "Peut-on comprendre **1"],
+                  ["**1 peut-il s'éduquer", "**1 peut-elle s'éduquer"],
+                  ["Peut-on échapper à **1", "Peut-on échapper à **1"],
+                  ["**1 n'est-il qu'un outil", "**1 n'est-elle qu'un outil"],
+                  ["**1 se limite-t-il à **2", "**1 se limite-t-elle à **2"],
+                  ["Que devons-nous à **1", "Que devons-nous à **1"],
+                  ["**1 nous permet-il de prendre conscience de **2",
+                   "**1 nous permet-elle de prendre conscience de **2"],
+                  ["Devons-nous aspirer à maîtriser **1", "Devons-nous aspirer à maîtriser **1"],
+                  ["**1 est-il contraire à **2", "**1 est-elle contraire à **2"],
+                  ["Peut-on vivre sans **1", "Peut-on vivre sans **1"],
+                  ["Avons-nous le devoir de chercher **1", "Avons-nous le devoir de chercher **1"],
+                  ["**1 a-t-il de la valeur", "**1 a-t-elle de la valeur"],
+                  ["**1 rend-t-il **2", "**1 rend-t-elle **2"]
+                  ]
+
+    epithetes = [["vrai", "vraie"],
+                 ["beau", "belle"],
+                 ["raisonnable", "raisonnable"],
+                 ["universel", "universelle"],
+                 ["désintéressé", "désintéressée"],
+                 ["naturel", "naturelle"],
+                 ["utile", "utile"],
+                 ["juste", "juste"],
+                 ["humain", "humaine"],
+                 ["historique", "historique"],
+                 ["libre", "libre"]
+                 ]
 
     part1 = sujets[random.randrange(0, len(sujets) - 1)]
-    if part1[1] == "m" :
-      chosen = 0
-    else :
-      chosen = 1
+    if part1[1] == "m":
+        chosen = 0
+    else:
+        chosen = 1
     struct = structures[random.randint(0, len(structures) - 1)][chosen]
     part1 = part1[0]
-    epi = epithetes[random.randint(0, len(epithetes) - 1 )][chosen]
-    part2 = sujets[random.randint(0, len(sujets) - 1 )][0]
-    if '**e' in struct :
+    epi = epithetes[random.randint(0, len(epithetes) - 1)][chosen]
+    part2 = sujets[random.randint(0, len(sujets) - 1)][0]
+    if '**e' in struct:
         result = struct.replace('**1', part1)
         result = result.replace('**e', epi)
-    else :
+    else:
         result = struct.replace('**1', part1)
         result = result.replace('**2', part2)
     result = result[0].upper() + result[1:]
     result = result + " ?"
     return result
-print (genererSujet())
-- 
GitLab