Esempio n. 1
0
def test_is_real():
    r = Room('aaaaa-bbb-z-y-x-123[abxyz]')
    assert r.is_real()
    r = Room('a-b-c-d-e-f-g-h-987[abcde]')
    assert r.is_real()
    r = Room('not-a-real-room-404[oarel]')
    assert r.is_real()
    r = Room('totally-real-room-200[decoy]')
    assert not r.is_real()
Esempio n. 2
0
from day04 import Room

with open('input.txt') as f:
    lines = f.readlines()
    sum_ = 0
    for line in lines:
        r = Room(line)
        if r.is_real():
            sum_ += r.sector_id
            if 'pole' in r.real_name:
                print(r.real_name)
                print(r.sector_id)
    print(sum_)