aoc2021/day04/part2.py
def last_win(grilles: dict, numbers: list, marks: set) -> int:
    """
    trouve le dernier board gagnant
    retroune le no de board, le numero sorti
    """
    # marks = set()
    boad_won = set()
    for n in numbers:
        # print("numero:", n)
        if n in marks:
            continue
        marks.add(n)
        for key, grille in grilles.items():
            if check_win_grille(grille, marks):
                # print("key: {}, boad_won:{}".format(key, boad_won))
                if key not in boad_won:
                    # print("key: {} not in board".format(key))
                    if len(boad_won) == len(grilles.keys()) - 1:
                        # print("->boad_won:", boad_won, n , key)
                        return key, n
                boad_won.add(key)
    return 0

    trouve le dernier board gagnant
    retroune le no de board, le numero sorti
    
trouve le dernier board gagnant
retroune le no de board, le numero sorti
trouve le dernier board gagnant retroune le no de board le numero sorti
def last_win(grilles: dict, numbers: list, marks: set) -> int:
    boad_won = set()
    for n in numbers:
        if n in marks:
            continue
        marks.add(n)
        for key, grille in grilles.items():
            if check_win_grille(grille, marks):
                if key not in boad_won:
                    if len(boad_won) == len(grilles.keys()) - 1:
                        return key, n
                boad_won.add(key)
    return 0
def last_win ( grilles : dict , numbers : list , marks : set ) -> int : boad_won = set ( ) for n in numbers : if n in marks : continue marks . add ( n ) for key , grille in grilles . items ( ) : if check_win_grille ( grille , marks ) : if key not in boad_won : if len ( boad_won ) == len ( grilles . keys ( ) ) - 1 : return key , n boad_won . add ( key ) return 0
trouve le dernier board gagnant
retroune le no de board, le numero sorti
trouve le dernier board gagnant retroune le no de board le numero sorti
"""
    trouve le dernier board gagnant
    retroune le no de board, le numero sorti
    """ # marks = set()
 # print("numero:", n)
 # print("key: {}, boad_won:{}".format(key, boad_won))
 # print("key: {} not in board".format(key))
 # print("->boad_won:", boad_won, n , key)

grilles
dict
numbers
list
marks
set