<reponame>secworks/advent_of_code_2020
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#=======================================================================
#
# day7.py
# -------
# Solutions to Advent of Code 2020, day 7.
# https://adventofcode.com/2020/day/7
#
#=======================================================================

import sys


#-------------------------------------------------------------------
#-------------------------------------------------------------------
def get_input(filename):
    l = []
    with open(filename,'r') as f:
        for line in f:
            l.append(line.strip())
    return l


#-------------------------------------------------------------------
#-------------------------------------------------------------------
def get_bags(filename):

    raw_rules = get_input(filename)

    for r in raw_rules:
        (target,  source) = r.split("bags contain")
        sources = source.split(",")
        print(target, "contain", sources)


#-------------------------------------------------------------------
#-------------------------------------------------------------------
def problem1(filename):
    print("Problem 1")
    print("---------")

    bags = get_bags(filename)

    print("")


#-------------------------------------------------------------------
#-------------------------------------------------------------------
def problem2(filename):
    print("Problem 2")
    print("---------")
    print("")


#-------------------------------------------------------------------
#-------------------------------------------------------------------
if __name__=="__main__":
    print("Advent of Code 2020, day 7")
    print("==========================")

    problem1("day7_input.txt")

    problem2("day7_input.txt")

    sys.exit(0)

#=======================================================================
#=======================================================================

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#=======================================================================
#
# day7.py
# -------
# Solutions to Advent of Code 2020, day 7.
# https://adventofcode.com/2020/day/7
#
#=======================================================================

import sys


#-------------------------------------------------------------------
#-------------------------------------------------------------------
def get_input(filename):
    l = []
    with open(filename,'r') as f:
        for line in f:
            l.append(line.strip())
    return l


#-------------------------------------------------------------------
#-------------------------------------------------------------------
def get_bags(filename):

    raw_rules = get_input(filename)

    for r in raw_rules:
        (target,  source) = r.split("bags contain")
        sources = source.split(",")
        print(target, "contain", sources)


#-------------------------------------------------------------------
#-------------------------------------------------------------------
def problem1(filename):
    print("Problem 1")
    print("---------")

    bags = get_bags(filename)

    print("")


#-------------------------------------------------------------------
#-------------------------------------------------------------------
def problem2(filename):
    print("Problem 2")
    print("---------")
    print("")


#-------------------------------------------------------------------
#-------------------------------------------------------------------
if __name__=="__main__":
    print("Advent of Code 2020, day 7")
    print("==========================")

    problem1("day7_input.txt")

    problem2("day7_input.txt")

    sys.exit(0)

#=======================================================================
#=======================================================================
#!/usr/bin/env python3 # -*- coding: utf-8 -*- #======================================================================= # # day7.py # ------- # Solutions to Advent of Code 2020, day 7. # https://adventofcode.com/2020/day/7 # #======================================================================= #------------------------------------------------------------------- #------------------------------------------------------------------- #------------------------------------------------------------------- #------------------------------------------------------------------- #------------------------------------------------------------------- #------------------------------------------------------------------- #------------------------------------------------------------------- #------------------------------------------------------------------- #------------------------------------------------------------------- #------------------------------------------------------------------- #======================================================================= #=======================================================================