This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import choice, shuffle | |
class Monty_Hall: | |
"""This represents the initial puzzle setup with three doors.""" | |
def __init__(self): | |
self.doors_to_chose_from = ["goat_1", "goat_2", "car"] | |
shuffle(self.doors_to_chose_from) | |
def __call__(self, change=True): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import namedtuple | |
from copy import deepcopy | |
MIN_ROW, MAX_ROW = 0, 9 | |
MIN_COLUMN, MAX_COLUMN = 0, 9 | |
total_successful_combinations = 0 | |
total_failed_combinations = 0 | |
Field = namedtuple('Field', 'row, column') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import defaultdict | |
with open(r'day_5') as f: | |
data = f.read() | |
first_part, second_part = data.split("\n\n") | |
first_part = [element.split("|") for element in first_part.split("\n")] | |
first_part = [[int(element) for element in rule] for rule in first_part] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with open(r'..\puzzle_inputs\day_6') as f: | |
data = f.read() | |
grid_list = [[position for position in element] for element in data.split("\n")] | |
grid = {(x, y): grid_list[y][x] for y in range(len(grid_list)) for x in range(len(grid_list[0]))} | |
GRID_WIDTH, GRID_HEIGHT = (len(grid_list[0]), len(grid_list)) | |
# directions |