# -*- coding: utf-8 -*-
"""
Created on Thu Jan 25 15:20:08 2024

@author: fort
"""

class File:
    """Création d'une file avec une liste"""
    def __init__(self):
        self.file=[]
    
    def __str__(self):
        """permet de représenter la file"""
        return str(self.file)
    
    def vide(self):
        "teste si la file est vide"
        return self.file==[]
        
    def defiler(self):
        "défile le premier élèment de la file"
        self.file.pop(0)
    
    def enfiler(self,x):
        "enfile l'élèment x"
        self.file.append(x)
    
    def taille(self):
        """

        Returns
        -------
        int taille de la file

        """
        return len(self.file)

    def sommet(self):
        """
        Returns
        -------
        int le sommet de la file

        """
        return self.file[0]
        
        
# F1 =File()
# F1.enfiler(1)
# F1.enfiler(2)
# F1.enfiler(3)
# print(F1)
# print(F1.vide())
# # F1.defiler()
# print(F1)
# print(F1.taille())
# print(F1.sommet())

# F2 =File()
# F2.enfiler(4)
# F2.enfiler(5)
# F2.enfiler(6)
# print(F2)
# print(F2.vide())
# F2.defiler()
# print(F2)
# print(F2.taille())
# print(F2.sommet())

class Croisement():
    def __init__(self):
        self.F1=File()
        self.F2=File()
        self.F3=File()

    
    def __str__(self):
        
        string=""
        string = string + str(self.F1)
        string = string + ","
        string = string + str(self.F2)
        string = string + ","
        string = string + str(self.F3)      
        return string
    
    def priorité(self):
        """"""
        if self.F1()==0:
            self.F1.defiler()
            self.F3.enfiler(self.F2.defiler())
        
carrefour=Croisement()
    

carrefour.F1.enfiler(0)
carrefour.F1.enfiler(1)
carrefour.F1.enfiler(1)
carrefour.F1.enfiler(0)
carrefour.F1.enfiler(1)


carrefour.F2.enfiler(0)
carrefour.F2.enfiler(2)
carrefour.F2.enfiler(2)
carrefour.F2.enfiler(2)
carrefour.F2.enfiler(0)
carrefour.F2.enfiler(2)
carrefour.F2.enfiler(0)



print(carrefour)


            