adventofcode.year_2021.day_2021_03.readable
Module Contents
Functions
|
Convert a list of 0s and 1s into an integer |
|
Compute the consumption rate for gamma and epsilon types |
|
Compute the rating value for O2 and CO2 |
|
|
|
Attributes
- adventofcode.year_2021.day_2021_03.readable.data
- adventofcode.year_2021.day_2021_03.readable.matrix
- adventofcode.year_2021.day_2021_03.readable.int_from_bin_list(lst)
Convert a list of 0s and 1s into an integer
- Args:
lst (list or numpy.array): list of 0s and 1s
- Returns:
int: resulting integer
- adventofcode.year_2021.day_2021_03.readable.consumption_rate(m, rate)
Compute the consumption rate for gamma and epsilon types
- Args:
m (numpy.array): 2-dimensional array of Os and 1s rate (str): type of consumption rate, either ‘gamma’ or ‘epsilon’
- Returns:
int: consumption rate for the given type
- adventofcode.year_2021.day_2021_03.readable.rating(m, molecule)
Compute the rating value for O2 and CO2
- Args:
m (numpy.array): 2-dimensional array of Os and 1s molecule (str): either ‘o2’ or ‘co2’
- Returns:
int: rating value
- adventofcode.year_2021.day_2021_03.readable.part1()
- adventofcode.year_2021.day_2021_03.readable.part2()