boB Rudis
3 years ago
5 changed files with 1455 additions and 480 deletions
@ -1,512 +1,512 @@ |
|||
"hcl" = stri_detect_regex(value, "^#[a-f[:digit:]]{6}$"), |
|||
"ecl" = value %in% c("amb", "blu", "brn", "gry", "grn", "hzl", "oth"), |
|||
"pid" = stri_detect_regex(value, "^[[:digit:]]{9}$"), |
|||
"cid" = TRUE, |
|||
TRUE |
|||
) |
|||
} |
|||
split(input, findInterval(1:length(input), which(input == ""))) %>% |
|||
map(~{ |
|||
paste0(.x, collapse = " ") %>% |
|||
stri_match_all_regex("([[:alpha:]]{3}):([^ $]+)") %>% |
|||
pluck(1) %>% |
|||
.[,2:3] %>% |
|||
as.data.frame() %>% |
|||
set_names(c("field", "value")) %>% |
|||
filter(field != "cid") -> found |
|||
# |
|||
# if (!all(found$field %in% req_keys) & (nrow(found) == length(req_keys))) return(FALSE) |
|||
# |
|||
found %>% |
|||
mutate( |
|||
valid = map2(field, value, validate) |
|||
) |
|||
}) |
|||
validate_height <- function(value) { |
|||
matches <- unlist(stri_match_first_regex(value, "^([[:digit:]]{2,3})(cm|in)$")) |
|||
# print(str(matches)) |
|||
if (part == trigger): |
|||
ub -= amt |
|||
else: |
|||
lb += amt |
|||
return(ub if (input[-1] == ret) else lb) |
|||
def get_seat(x): |
|||
return( |
|||
switch( |
|||
matches[2], |
|||
"cm" = between(as.integer(m[2]), 150, 193), |
|||
"in" = between(as.integer(m[2]), 59, 76), |
|||
FALSE |
|||
(partition(x[0:6], 0, 127, "F", "F") * 8) + |
|||
partition(x[7:9], 0, 7, "L", "R") |
|||
) |
|||
} |
|||
validate <- function(field, value) { |
|||
# print(str(field)) |
|||
# print(str(value)) |
|||
res = [ get_seat(bpass) for bpass in input ] |
|||
# 05-01 |
|||
res.sort() |
|||
max(res) |
|||
import math |
|||
import operator |
|||
# with open("../input/04-01.txt") as f: |
|||
with open("/tmp/test.txt") as f: |
|||
input = f.read().splitlines() |
|||
def partition(input, lb, ub, trigger, ret): |
|||
for idx, part in enumerate(input): |
|||
amt = math.floor((ub - lb)/2) + 1 |
|||
if (part == trigger): |
|||
ub -= amt |
|||
else: |
|||
lb += amt |
|||
return(ub if (input[-1] == ret) else lb) |
|||
def get_seat(x): |
|||
return( |
|||
suppressWarnings( |
|||
switch( |
|||
field, |
|||
"byr" = stri_detect_regex(value, "^[[:digit:]]{4}$") & between(as.integer(value), 1920, 2002), |
|||
"iyr" = stri_detect_regex(value, "^[[:digit:]]{4}$") & between(as.integer(value), 2010, 2020), |
|||
"eyr" = stri_detect_regex(value, "^[[:digit:]]{4}$") & between(as.integer(value), 2020, 2030), |
|||
"hgt" = stri_detect_regex(value, "^[[:digit:]]{2,3}(cm|in)$") & validate_height(value), |
|||
"hcl" = stri_detect_regex(value, "^#[a-f[:digit:]]{6}$"), |
|||
"ecl" = value %in% c("amb", "blu", "brn", "gry", "grn", "hzl", "oth"), |
|||
"pid" = stri_detect_regex(value, "^[[:digit:]]{9}$"), |
|||
"cid" = TRUE, |
|||
TRUE |
|||
(partition(x[0:6], 0, 127, "F", "F") * 8) + |
|||
partition(x[7:9], 0, 7, "L", "R") |
|||
) |
|||
} |
|||
split(input, findInterval(1:length(input), which(input == ""))) %>% |
|||
map(~{ |
|||
paste0(.x, collapse = " ") %>% |
|||
stri_match_all_regex("([[:alpha:]]{3}):([^ $]+)") %>% |
|||
pluck(1) %>% |
|||
.[,2:3] %>% |
|||
as.data.frame() %>% |
|||
set_names(c("field", "value")) %>% |
|||
filter(field != "cid") -> found |
|||
# |
|||
# if (!all(found$field %in% req_keys) & (nrow(found) == length(req_keys))) return(FALSE) |
|||
# |
|||
found %>% |
|||
mutate( |
|||
valid = map2(field, value, validate) |
|||
) |
|||
}) |
|||
validate_height <- function(value) { |
|||
matches <- unlist(stri_match_first_regex(value, "^([[:digit:]]{2,3})(cm|in)$")) |
|||
# print(str(matches)) |
|||
res = [ get_seat(bpass) for bpass in input ] |
|||
# 05-01 |
|||
res.sort() |
|||
max(res) |
|||
# 05-02 |
|||
res.insert(0, res[0]) |
|||
list(map(operator.sub, res[1:], res[:-1])) |
|||
with open("../input/05-01.txt") as f: |
|||
# with open("/tmp/test.txt") as f: |
|||
input = f.read().splitlines() |
|||
def partition(input, lb, ub, trigger, ret): |
|||
for idx, part in enumerate(input): |
|||
amt = math.floor((ub - lb)/2) + 1 |
|||
if (part == trigger): |
|||
ub -= amt |
|||
else: |
|||
lb += amt |
|||
return(ub if (input[-1] == ret) else lb) |
|||
def get_seat(x): |
|||
return( |
|||
switch( |
|||
matches[3], |
|||
"cm" = between(as.integer(m[2]), 150, 193), |
|||
"in" = between(as.integer(m[2]), 59, 76), |
|||
FALSE |
|||
) |
|||
} |
|||
validate <- function(field, value) { |
|||
# print(str(field)) |
|||
# print(str(value)) |
|||
(partition(x[0:6], 0, 127, "F", "F") * 8) + |
|||
partition(x[7:9], 0, 7, "L", "R") |
|||
import math |
|||
import operator |
|||
with open("../input/05-01.txt") as f: |
|||
# with open("/tmp/test.txt") as f: |
|||
input = f.read().splitlines() |
|||
def partition(input, lb, ub, trigger, ret): |
|||
for idx, part in enumerate(input): |
|||
amt = math.floor((ub - lb)/2) + 1 |
|||
if (part == trigger): |
|||
ub -= amt |
|||
else: |
|||
lb += amt |
|||
return(ub if (input[-1] == ret) else lb) |
|||
def get_seat(x): |
|||
return( |
|||
suppressWarnings( |
|||
switch( |
|||
field, |
|||
"byr" = stri_detect_regex(value, "^[[:digit:]]{4}$") & between(as.integer(value), 1920, 2002), |
|||
"iyr" = stri_detect_regex(value, "^[[:digit:]]{4}$") & between(as.integer(value), 2010, 2020), |
|||
"eyr" = stri_detect_regex(value, "^[[:digit:]]{4}$") & between(as.integer(value), 2020, 2030), |
|||
"hgt" = stri_detect_regex(value, "^[[:digit:]]{2,3}(cm|in)$") & validate_height(value), |
|||
"hcl" = stri_detect_regex(value, "^#[a-f[:digit:]]{6}$"), |
|||
"ecl" = value %in% c("amb", "blu", "brn", "gry", "grn", "hzl", "oth"), |
|||
"pid" = stri_detect_regex(value, "^[[:digit:]]{9}$"), |
|||
"cid" = TRUE, |
|||
TRUE |
|||
) |
|||
} |
|||
split(input, findInterval(1:length(input), which(input == ""))) %>% |
|||
map(~{ |
|||
paste0(.x, collapse = " ") %>% |
|||
stri_match_all_regex("([[:alpha:]]{3}):([^ $]+)") %>% |
|||
pluck(1) %>% |
|||
.[,2:3] %>% |
|||
as.data.frame() %>% |
|||
set_names(c("field", "value")) %>% |
|||
filter(field != "cid") -> found |
|||
# |
|||
# if (!all(found$field %in% req_keys) & (nrow(found) == length(req_keys))) return(FALSE) |
|||
# |
|||
found %>% |
|||
mutate( |
|||
valid = map2(field, value, validate) |
|||
(partition(x[0:6], 0, 127, "F", "F") * 8) + |
|||
partition(x[7:9], 0, 7, "L", "R") |
|||
) |
|||
}) |
|||
split(input, findInterval(1:length(input), which(input == ""))) %>% |
|||
map(~{ |
|||
paste0(.x, collapse = " ") %>% |
|||
stri_match_all_regex("([[:alpha:]]{3}):([^ $]+)") %>% |
|||
pluck(1) %>% |
|||
.[,2:3] %>% |
|||
as.data.frame() %>% |
|||
set_names(c("field", "value")) %>% |
|||
filter(field != "cid") -> found |
|||
# |
|||
# if (!all(found$field %in% req_keys) & (nrow(found) == length(req_keys))) return(FALSE) |
|||
# |
|||
res = [ get_seat(bpass) for bpass in input ] |
|||
res.sort() |
|||
max(res) |
|||
res.insert(0, res[0]) |
|||
list(map(operator.sub, res[1:], res[:-1])) |
|||
res.pop(0) |
|||
import math |
|||
import operator |
|||
with open("../input/05-01.txt") as f: |
|||
# with open("/tmp/test.txt") as f: |
|||
input = f.read().splitlines() |
|||
def partition(input, lb, ub, trigger, ret): |
|||
for idx, part in enumerate(input): |
|||
amt = math.floor((ub - lb)/2) + 1 |
|||
if (part == trigger): |
|||
ub -= amt |
|||
else: |
|||
lb += amt |
|||
return(ub if (input[-1] == ret) else lb) |
|||
def get_seat(x): |
|||
return( |
|||
found %>% |
|||
mutate( |
|||
valid = map2(field, value, validate) |
|||
(partition(x[0:6], 0, 127, "F", "F") * 8) + |
|||
partition(x[7:9], 0, 7, "L", "R") |
|||
) |
|||
}) -> x |
|||
split(input, findInterval(1:length(input), which(input == ""))) %>% |
|||
map_lgl(~{ |
|||
paste0(.x, collapse = " ") %>% |
|||
stri_match_all_regex("([[:alpha:]]{3}):([^ $]+)") %>% |
|||
pluck(1) %>% |
|||
.[,2:3] %>% |
|||
as.data.frame() %>% |
|||
set_names(c("field", "value")) %>% |
|||
filter(field != "cid") -> found |
|||
if (!all(found$field %in% req_keys) & (nrow(found) == length(req_keys))) return(FALSE) |
|||
all(map2_lgl(field, value, validate)) |
|||
}) |
|||
split(input, findInterval(1:length(input), which(input == ""))) %>% |
|||
map_lgl(~{ |
|||
paste0(.x, collapse = " ") %>% |
|||
stri_match_all_regex("([[:alpha:]]{3}):([^ $]+)") %>% |
|||
pluck(1) %>% |
|||
.[,2:3] %>% |
|||
as.data.frame() %>% |
|||
set_names(c("field", "value")) %>% |
|||
filter(field != "cid") -> found |
|||
if (!all(found$field %in% req_keys) & (nrow(found) == length(req_keys))) return(FALSE) |
|||
all(map2_lgl(found$field, found$value, validate)) |
|||
}) |
|||
validate_height <- function(value) { |
|||
matches <- unlist(stri_match_first_regex(value, "^([[:digit:]]{2,3})(cm|in)$")) |
|||
# print(str(matches)) |
|||
res = [ get_seat(bpass) for bpass in input ] |
|||
# 05-01 |
|||
res.sort() |
|||
max(res) |
|||
# 05-02 |
|||
res.insert(0, res[0]) |
|||
res |
|||
import numpy as geek |
|||
pyconfig() |
|||
import math |
|||
import numpy as geek |
|||
with open("../input/05-01.txt") as f: |
|||
# with open("/tmp/test.txt") as f: |
|||
input = f.read().splitlines() |
|||
import math |
|||
import numpy as geek |
|||
with open("../input/05-01.txt") as f: |
|||
# with open("/tmp/test.txt") as f: |
|||
input = f.read().splitlines() |
|||
def partition(input, lb, ub, trigger, ret): |
|||
for idx, part in enumerate(input): |
|||
amt = math.floor((ub - lb)/2) + 1 |
|||
if (part == trigger): |
|||
ub -= amt |
|||
else: |
|||
lb += amt |
|||
return(ub if (input[-1] == ret) else lb) |
|||
def get_seat(x): |
|||
return( |
|||
switch( |
|||
matches[3], |
|||
"cm" = between(as.integer(matches[2]), 150, 193), |
|||
"in" = between(as.integer(matches[2]), 59, 76), |
|||
FALSE |
|||
(partition(x[0:6], 0, 127, "F", "F") * 8) + |
|||
partition(x[7:9], 0, 7, "L", "R") |
|||
) |
|||
} |
|||
validate <- function(field, value) { |
|||
# print(str(field)) |
|||
# print(str(value)) |
|||
res = [ get_seat(bpass) for bpass in input ] |
|||
# 05-01 |
|||
res.sort() |
|||
max(res) |
|||
res.insert(0, res[0]) |
|||
diff(res) |
|||
import numpy as np |
|||
np.diff(res) |
|||
import math |
|||
import numpy as np |
|||
import math |
|||
import numpy as np |
|||
with open("../input/05-01.txt") as f: |
|||
# with open("/tmp/test.txt") as f: |
|||
input = f.read().splitlines() |
|||
def partition(input, lb, ub, trigger, ret): |
|||
for idx, part in enumerate(input): |
|||
amt = math.floor((ub - lb)/2) + 1 |
|||
if (part == trigger): |
|||
ub -= amt |
|||
else: |
|||
lb += amt |
|||
return(ub if (input[-1] == ret) else lb) |
|||
def get_seat(x): |
|||
return( |
|||
suppressWarnings( |
|||
switch( |
|||
field, |
|||
"byr" = stri_detect_regex(value, "^[[:digit:]]{4}$") & between(as.integer(value), 1920, 2002), |
|||
"iyr" = stri_detect_regex(value, "^[[:digit:]]{4}$") & between(as.integer(value), 2010, 2020), |
|||
"eyr" = stri_detect_regex(value, "^[[:digit:]]{4}$") & between(as.integer(value), 2020, 2030), |
|||
"hgt" = stri_detect_regex(value, "^[[:digit:]]{2,3}(cm|in)$") & validate_height(value), |
|||
"hcl" = stri_detect_regex(value, "^#[a-f[:digit:]]{6}$"), |
|||
"ecl" = value %in% c("amb", "blu", "brn", "gry", "grn", "hzl", "oth"), |
|||
"pid" = stri_detect_regex(value, "^[[:digit:]]{9}$"), |
|||
"cid" = TRUE, |
|||
TRUE |
|||
(partition(x[0:6], 0, 127, "F", "F") * 8) + |
|||
partition(x[7:9], 0, 7, "L", "R") |
|||
) |
|||
res = [ get_seat(bpass) for bpass in input ] |
|||
reticulate::repl_python() |
|||
library(tidyverse) |
|||
# input <- readLines("/tmp/test.txt") |
|||
input <- readLines("../input/05-01.txt") |
|||
strsplit(input, "") %>% |
|||
map_dbl(~{ |
|||
rng <- c(0, 127) |
|||
for (part in .x[1:7]) { |
|||
amt <- floor((rng[2] - rng[1])/2) + 1 |
|||
if (part == "F") { |
|||
rng[2] <- rng[2] - amt |
|||
} else { |
|||
rng[1] <- rng[1] + amt |
|||
} |
|||
split(input, findInterval(1:length(input), which(input == ""))) %>% |
|||
map_lgl(~{ |
|||
paste0(.x, collapse = " ") %>% |
|||
stri_match_all_regex("([[:alpha:]]{3}):([^ $]+)") %>% |
|||
pluck(1) %>% |
|||
.[,2:3] %>% |
|||
as.data.frame() %>% |
|||
set_names(c("field", "value")) %>% |
|||
filter(field != "cid") -> found |
|||
if (!all(found$field %in% req_keys) & (nrow(found) == length(req_keys))) return(FALSE) |
|||
all(map2_lgl(found$field, found$value, validate)) |
|||
}) |
|||
validate_height <- function(value) { |
|||
matches <- unlist(stri_match_first_regex(value, "^([[:digit:]]{2,3})(cm|in)$")) |
|||
print(str(matches)) |
|||
return( |
|||
switch( |
|||
matches[3], |
|||
"cm" = between(as.integer(matches[2]), 150, 193), |
|||
"in" = between(as.integer(matches[2]), 59, 76), |
|||
FALSE |
|||
) |
|||
row <- if (.x[7] == "F") rng[1] else rng[2] |
|||
rng <- c(0, 7) |
|||
for (part in .x[8:10]) { |
|||
amt <- floor((rng[2] - rng[1])/2) + 1 |
|||
if (part == "L") { |
|||
rng[2] <- rng[2] - amt |
|||
} else { |
|||
rng[1] <- rng[1] + amt |
|||
} |
|||
validate <- function(field, value) { |
|||
# print(str(field)) |
|||
# print(str(value)) |
|||
return( |
|||
suppressWarnings( |
|||
switch( |
|||
field, |
|||
"byr" = stri_detect_regex(value, "^[[:digit:]]{4}$") & between(as.integer(value), 1920, 2002), |
|||
"iyr" = stri_detect_regex(value, "^[[:digit:]]{4}$") & between(as.integer(value), 2010, 2020), |
|||
"eyr" = stri_detect_regex(value, "^[[:digit:]]{4}$") & between(as.integer(value), 2020, 2030), |
|||
"hgt" = stri_detect_regex(value, "^[[:digit:]]{2,3}(cm|in)$") & validate_height(value), |
|||
"hcl" = stri_detect_regex(value, "^#[a-f[:digit:]]{6}$"), |
|||
"ecl" = value %in% c("amb", "blu", "brn", "gry", "grn", "hzl", "oth"), |
|||
"pid" = stri_detect_regex(value, "^[[:digit:]]{9}$"), |
|||
"cid" = TRUE, |
|||
TRUE |
|||
) |
|||
seat <- if (.x[10] == "R") rng[1] else rng[2] |
|||
(row * 8) + seat |
|||
}) %>% |
|||
sort() -> seats |
|||
max(seats) |
|||
reticulate::repl_python() |
|||
# --- Day 5: Binary Boarding --- |
|||
# |
|||
# You board your plane only to discover a new problem: you dropped your boarding |
|||
# pass! You aren't sure which seat is yours, and all of the flight attendants |
|||
# are busy with the flood of people that suddenly made it through passport |
|||
# control. |
|||
# |
|||
# You write a quick program to use your phone's camera to scan all of the nearby |
|||
# boarding passes (your puzzle input); perhaps you can find your seat through |
|||
# process of elimination. |
|||
# |
|||
# Instead of zones or groups, this airline uses binary space partitioning to |
|||
# seat people. A seat might be specified like FBFBBFFRLR, where F means "front", |
|||
# B means "back", L means "left", and R means "right". |
|||
# |
|||
# The first 7 characters will either be F or B; these specify exactly one of |
|||
# the 128 rows on the plane (numbered 0 through 127). Each letter tells you |
|||
# which half of a region the given seat is in. Start with the whole list of |
|||
# rows; the first letter indicates whether the seat is in the front |
|||
# (0 through 63) or the back (64 through 127). The next letter indicates which |
|||
# half of that region the seat is in, and so on until you're left with |
|||
# exactly one row. |
|||
# |
|||
# For example, consider just the first seven characters of FBFBBFFRLR: |
|||
# |
|||
# Start by considering the whole range, rows 0 through 127. |
|||
# F means to take the lower half, keeping rows 0 through 63. |
|||
# B means to take the upper half, keeping rows 32 through 63. |
|||
# F means to take the lower half, keeping rows 32 through 47. |
|||
# B means to take the upper half, keeping rows 40 through 47. |
|||
# B keeps rows 44 through 47. |
|||
# F keeps rows 44 through 45. |
|||
# The final F keeps the lower of the two, row 44. |
|||
# |
|||
# The last three characters will be either L or R; these specify exactly one |
|||
# of the 8 columns of seats on the plane (numbered 0 through 7). The same |
|||
# process as above proceeds again, this time with only three steps. L means |
|||
# to keep the lower half, while R means to keep the upper half. |
|||
# |
|||
# For example, consider just the last 3 characters of FBFBBFFRLR: |
|||
# |
|||
# Start by considering the whole range, columns 0 through 7. |
|||
# R means to take the upper half, keeping columns 4 through 7. |
|||
# L means to take the lower half, keeping columns 4 through 5. |
|||
# The final R keeps the upper of the two, column 5. |
|||
# |
|||
# So, decoding FBFBBFFRLR reveals that it is the seat at row 44, column 5. |
|||
# |
|||
# Every seat also has a unique seat ID: multiply the row by 8, then add the |
|||
# column. In this example, the seat has ID 44 * 8 + 5 = 357. |
|||
# |
|||
# Here are some other boarding passes: |
|||
# |
|||
# BFFFBBFRRR: row 70, column 7, seat ID 567. |
|||
# FFFBBBFRRR: row 14, column 7, seat ID 119. |
|||
# BBFFBBFRLL: row 102, column 4, seat ID 820. |
|||
# As a sanity check, look through your list of boarding passes. What is the |
|||
# highest seat ID on a boarding pass? |
|||
library(tidyverse) |
|||
# input <- readLines("/tmp/test.txt") |
|||
input <- readLines("../input/05-01.txt") |
|||
strsplit(input, "") %>% |
|||
map_dbl(~{ |
|||
rng <- c(0, 127) |
|||
for (part in .x[1:7]) { |
|||
amt <- floor((rng[2] - rng[1])/2) + 1 |
|||
if (part == "F") { |
|||
rng[2] <- rng[2] - amt |
|||
} else { |
|||
rng[1] <- rng[1] + amt |
|||
} |
|||
split(input, findInterval(1:length(input), which(input == ""))) %>% |
|||
map_lgl(~{ |
|||
paste0(.x, collapse = " ") %>% |
|||
stri_match_all_regex("([[:alpha:]]{3}):([^ $]+)") %>% |
|||
pluck(1) %>% |
|||
.[,2:3] %>% |
|||
as.data.frame() %>% |
|||
set_names(c("field", "value")) %>% |
|||
filter(field != "cid") -> found |
|||
if (!all(found$field %in% req_keys) & (nrow(found) == length(req_keys))) return(FALSE) |
|||
all(map2_lgl(found$field, found$value, validate)) |
|||
}) |
|||
split(input, findInterval(1:length(input), which(input == ""))) %>% |
|||
map_lgl(~{ |
|||
paste0(.x, collapse = " ") %>% |
|||
stri_match_all_regex("([[:alpha:]]{3}):([^ $]+)") %>% |
|||
pluck(1) %>% |
|||
.[,2:3] %>% |
|||
as.data.frame() %>% |
|||
set_names(c("field", "value")) %>% |
|||
filter(field != "cid") -> found |
|||
if (!(all(found$field %in% req_keys) & (length(found$field) == length(req_keys)))) return(FALSE) |
|||
all(map2_lgl(found$field, found$value, validate)) |
|||
}) |
|||
validate_height <- function(value) { |
|||
matches <- unlist(stri_match_first_regex(value, "^([[:digit:]]{2,3})(cm|in)$")) |
|||
return( |
|||
suppressWarnings( |
|||
switch( |
|||
matches[3], |
|||
"cm" = between(as.integer(matches[2]), 150, 193), |
|||
"in" = between(as.integer(matches[2]), 59, 76), |
|||
FALSE |
|||
) |
|||
row <- if (.x[7] == "F") rng[1] else rng[2] |
|||
rng <- c(0, 7) |
|||
for (part in .x[8:10]) { |
|||
amt <- floor((rng[2] - rng[1])/2) |
|||
if (part == "L") { |
|||
rng[2] <- rng[2] - amt |
|||
} else { |
|||
rng[1] <- rng[1] + amt |
|||
} |
|||
validate <- function(field, value) { |
|||
return( |
|||
suppressWarnings( |
|||
switch( |
|||
field, |
|||
"byr" = stri_detect_regex(value, "^[[:digit:]]{4}$") & between(as.integer(value), 1920, 2002), |
|||
"iyr" = stri_detect_regex(value, "^[[:digit:]]{4}$") & between(as.integer(value), 2010, 2020), |
|||
"eyr" = stri_detect_regex(value, "^[[:digit:]]{4}$") & between(as.integer(value), 2020, 2030), |
|||
"hgt" = stri_detect_regex(value, "^[[:digit:]]{2,3}(cm|in)$") & validate_height(value), |
|||
"hcl" = stri_detect_regex(value, "^#[a-f[:digit:]]{6}$"), |
|||
"ecl" = value %in% c("amb", "blu", "brn", "gry", "grn", "hzl", "oth"), |
|||
"pid" = stri_detect_regex(value, "^[[:digit:]]{9}$"), |
|||
"cid" = TRUE, |
|||
TRUE |
|||
) |
|||
seat <- if (.x[10] == "R") rng[1] else rng[2] |
|||
(row * 8) + seat |
|||
}) %>% |
|||
sort() -> seats |
|||
max(seats) |
|||
# --- Day 5: Binary Boarding --- |
|||
# |
|||
# You board your plane only to discover a new problem: you dropped your boarding |
|||
# pass! You aren't sure which seat is yours, and all of the flight attendants |
|||
# are busy with the flood of people that suddenly made it through passport |
|||
# control. |
|||
# |
|||
# You write a quick program to use your phone's camera to scan all of the nearby |
|||
# boarding passes (your puzzle input); perhaps you can find your seat through |
|||
# process of elimination. |
|||
# |
|||
# Instead of zones or groups, this airline uses binary space partitioning to |
|||
# seat people. A seat might be specified like FBFBBFFRLR, where F means "front", |
|||
# B means "back", L means "left", and R means "right". |
|||
# |
|||
# The first 7 characters will either be F or B; these specify exactly one of |
|||
# the 128 rows on the plane (numbered 0 through 127). Each letter tells you |
|||
# which half of a region the given seat is in. Start with the whole list of |
|||
# rows; the first letter indicates whether the seat is in the front |
|||
# (0 through 63) or the back (64 through 127). The next letter indicates which |
|||
# half of that region the seat is in, and so on until you're left with |
|||
# exactly one row. |
|||
# |
|||
# For example, consider just the first seven characters of FBFBBFFRLR: |
|||
# |
|||
# Start by considering the whole range, rows 0 through 127. |
|||
# F means to take the lower half, keeping rows 0 through 63. |
|||
# B means to take the upper half, keeping rows 32 through 63. |
|||
# F means to take the lower half, keeping rows 32 through 47. |
|||
# B means to take the upper half, keeping rows 40 through 47. |
|||
# B keeps rows 44 through 47. |
|||
# F keeps rows 44 through 45. |
|||
# The final F keeps the lower of the two, row 44. |
|||
# |
|||
# The last three characters will be either L or R; these specify exactly one |
|||
# of the 8 columns of seats on the plane (numbered 0 through 7). The same |
|||
# process as above proceeds again, this time with only three steps. L means |
|||
# to keep the lower half, while R means to keep the upper half. |
|||
# |
|||
# For example, consider just the last 3 characters of FBFBBFFRLR: |
|||
# |
|||
# Start by considering the whole range, columns 0 through 7. |
|||
# R means to take the upper half, keeping columns 4 through 7. |
|||
# L means to take the lower half, keeping columns 4 through 5. |
|||
# The final R keeps the upper of the two, column 5. |
|||
# |
|||
# So, decoding FBFBBFFRLR reveals that it is the seat at row 44, column 5. |
|||
# |
|||
# Every seat also has a unique seat ID: multiply the row by 8, then add the |
|||
# column. In this example, the seat has ID 44 * 8 + 5 = 357. |
|||
# |
|||
# Here are some other boarding passes: |
|||
# |
|||
# BFFFBBFRRR: row 70, column 7, seat ID 567. |
|||
# FFFBBBFRRR: row 14, column 7, seat ID 119. |
|||
# BBFFBBFRLL: row 102, column 4, seat ID 820. |
|||
# As a sanity check, look through your list of boarding passes. What is the |
|||
# highest seat ID on a boarding pass? |
|||
library(tidyverse) |
|||
# input <- readLines("/tmp/test.txt") |
|||
input <- readLines("../input/05-01.txt") |
|||
strsplit(input, "") %>% |
|||
map_dbl(~{ |
|||
rng <- c(0, 127) |
|||
for (part in .x[1:7]) { |
|||
amt <- floor((rng[2] - rng[1])/2) + 1 |
|||
if (part == "F") { |
|||
rng[2] <- rng[2] - amt |
|||
} else { |
|||
rng[1] <- rng[1] + amt |
|||
} |
|||
row <- if (.x[7] == "F") rng[1] else rng[2] |
|||
rng <- c(0, 7) |
|||
for (part in .x[8:10]) { |
|||
amt <- floor((rng[2] - rng[1])/2) + 1 |
|||
if (part == "L") { |
|||
rng[2] <- rng[2] - amt |
|||
} else { |
|||
rng[1] <- rng[1] + amt |
|||
} |
|||
split(input, findInterval(1:length(input), which(input == ""))) %>% |
|||
map_lgl(~{ |
|||
paste0(.x, collapse = " ") %>% |
|||
stri_match_all_regex("([[:alpha:]]{3}):([^ $]+)") %>% |
|||
pluck(1) %>% |
|||
.[,2:3] %>% |
|||
as.data.frame() %>% |
|||
set_names(c("field", "value")) %>% |
|||
filter(field != "cid") -> found |
|||
if (!(all(found$field %in% req_keys) & (length(found$field) == length(req_keys)))) return(FALSE) |
|||
all(map2_lgl(found$field, found$value, validate)) |
|||
}) |
|||
split(input, findInterval(1:length(input), which(input == ""))) %>% |
|||
map_lgl(~{ |
|||
paste0(.x, collapse = " ") %>% |
|||
stri_match_all_regex("([[:alpha:]]{3}):([^ $]+)") %>% |
|||
pluck(1) %>% |
|||
.[,2:3] %>% |
|||
as.data.frame() %>% |
|||
set_names(c("field", "value")) %>% |
|||
filter(field != "cid") -> found |
|||
if (!(all(found$field %in% req_keys) & (length(found$field) == length(req_keys)))) return(FALSE) |
|||
all(map2_lgl(found$field, found$value, validate)) |
|||
seat <- if (.x[10] == "R") rng[1] else rng[2] |
|||
(row * 8) + seat |
|||
}) %>% |
|||
sum() |
|||
sort() -> seats |
|||
max(seats) |
|||
seats |
|||
reticulate::repl_python() |
|||
input <- readLines("/tmp/test.txt") |
|||
strsplit(input, "") %>% |
|||
map_dbl(~{ |
|||
rng <- c(0, 127) |
|||
for (part in .x[1:7]) { |
|||
cat(rng[1], ", ", rng[2], "\n", sep="") |
|||
amt <- floor((rng[2] - rng[1])/2) + 1 |
|||
if (part == "F") { |
|||
rng[2] <- rng[2] - amt |
|||
} else { |
|||
rng[1] <- rng[1] + amt |
|||
} |
|||
row <- if (.x[7] == "F") rng[1] else rng[2] |
|||
rng <- c(0, 7) |
|||
for (part in .x[8:10]) { |
|||
cat(rng[1], ", ", rng[2], "\n", sep="") |
|||
amt <- floor((rng[2] - rng[1])/2) + 1 |
|||
if (part == "L") { |
|||
rng[2] <- rng[2] - amt |
|||
} else { |
|||
rng[1] <- rng[1] + amt |
|||
} |
|||
seat <- if (.x[10] == "R") rng[1] else rng[2] |
|||
(row * 8) + seat |
|||
}) %>% |
|||
sort() -> seats |
|||
max(seats) |
|||
seats |
|||
# input <- readLines("/tmp/test.txt") |
|||
input <- readLines("../input/04-01.txt") |
|||
split(input, findInterval(1:length(input), which(input == ""))) %>% |
|||
map_lgl(~{ |
|||
paste0(.x, collapse = " ") %>% |
|||
stri_match_all_regex("([[:alpha:]]{3}):([^ $]+)") %>% |
|||
pluck(1) %>% |
|||
.[,2] %>% |
|||
discard(`==`, 'cid') -> found |
|||
all(found %in% req_keys) & (length(found) == length(req_keys)) |
|||
input <- readLines("../input/05-01.txt") |
|||
strsplit(input, "") %>% |
|||
map_dbl(~{ |
|||
rng <- c(0, 127) |
|||
for (part in .x[1:7]) { |
|||
amt <- floor((rng[2] - rng[1])/2) + 1 |
|||
if (part == "F") { |
|||
rng[2] <- rng[2] - amt |
|||
} else { |
|||
rng[1] <- rng[1] + amt |
|||
} |
|||
row <- if (.x[7] == "F") rng[1] else rng[2] |
|||
rng <- c(0, 7) |
|||
for (part in .x[8:10]) { |
|||
amt <- floor((rng[2] - rng[1])/2) + 1 |
|||
if (part == "L") { |
|||
rng[2] <- rng[2] - amt |
|||
} else { |
|||
rng[1] <- rng[1] + amt |
|||
} |
|||
seat <- if (.x[10] == "R") rng[1] else rng[2] |
|||
(row * 8) + seat |
|||
}) %>% |
|||
sum() |
|||
validate_height <- function(value) { |
|||
matches <- unlist(stri_match_first_regex(value, "^([[:digit:]]{2,3})(cm|in)$")) |
|||
return( |
|||
suppressWarnings( |
|||
switch( |
|||
matches[3], |
|||
"cm" = between(as.integer(matches[2]), 150, 193), |
|||
"in" = between(as.integer(matches[2]), 59, 76), |
|||
FALSE |
|||
) |
|||
sort() -> seats |
|||
max(seats) |
|||
seats[which(diff(c(seats[1], seats)) > 1)] |
|||
seats[which(diff(c(seats[1], seats)) > 1)] - 1 |
|||
reticulate::repl_python() |
|||
input <- readLines("/tmp/test.txt") |
|||
# input <- readLines("../input/05-01.txt") |
|||
strsplit(input, "") %>% |
|||
map_dbl(~{ |
|||
rng <- c(0, 127) |
|||
for (part in .x[1:7]) { |
|||
message(str(rng)) |
|||
amt <- floor((rng[2] - rng[1])/2) + 1 |
|||
if (part == "F") { |
|||
rng[2] <- rng[2] - amt |
|||
} else { |
|||
rng[1] <- rng[1] + amt |
|||
} |
|||
validate <- function(field, value) { |
|||
return( |
|||
suppressWarnings( |
|||
switch( |
|||
field, |
|||
"byr" = stri_detect_regex(value, "^[[:digit:]]{4}$") & between(as.integer(value), 1920, 2002), |
|||
"iyr" = stri_detect_regex(value, "^[[:digit:]]{4}$") & between(as.integer(value), 2010, 2020), |
|||
"eyr" = stri_detect_regex(value, "^[[:digit:]]{4}$") & between(as.integer(value), 2020, 2030), |
|||
"hgt" = stri_detect_regex(value, "^[[:digit:]]{2,3}(cm|in)$") & validate_height(value), |
|||
"hcl" = stri_detect_regex(value, "^#[a-f[:digit:]]{6}$"), |
|||
"ecl" = value %in% c("amb", "blu", "brn", "gry", "grn", "hzl", "oth"), |
|||
"pid" = stri_detect_regex(value, "^[[:digit:]]{9}$"), |
|||
"cid" = TRUE, |
|||
TRUE |
|||
) |
|||
row <- if (.x[7] == "F") rng[1] else rng[2] |
|||
rng <- c(0, 7) |
|||
for (part in .x[8:10]) { |
|||
message(str(rng)) |
|||
amt <- floor((rng[2] - rng[1])/2) + 1 |
|||
if (part == "L") { |
|||
rng[2] <- rng[2] - amt |
|||
} else { |
|||
rng[1] <- rng[1] + amt |
|||
} |
|||
split(input, findInterval(1:length(input), which(input == ""))) %>% |
|||
map_lgl(~{ |
|||
paste0(.x, collapse = " ") %>% |
|||
stri_match_all_regex("([[:alpha:]]{3}):([^ $]+)") %>% |
|||
pluck(1) %>% |
|||
.[,2:3] %>% |
|||
as.data.frame() %>% |
|||
set_names(c("field", "value")) %>% |
|||
filter(field != "cid") -> found |
|||
if (!(all(found$field %in% req_keys) & (length(found$field) == length(req_keys)))) return(FALSE) |
|||
all(map2_lgl(found$field, found$value, validate)) |
|||
seat <- if (.x[10] == "R") rng[1] else rng[2] |
|||
(row * 8) + seat |
|||
}) %>% |
|||
sum() |
|||
sort() -> seats |
|||
library(tidyverse) |
|||
input <- readLines("/tmp/test.txt") |
|||
strsplit(input, "") %>% |
|||
map_dbl(~{ |
|||
rng <- c(0, 127) |
|||
for (part in .x[1:7]) { |
|||
message(str(rng)) |
|||
amt <- floor((rng[2] - rng[1])/2) + 1 |
|||
if (part == "F") { |
|||
rng[2] <- rng[2] - amt |
|||
} else { |
|||
rng[1] <- rng[1] + amt |
|||
} |
|||
row <- if (.x[7] == "F") rng[1] else rng[2] |
|||
rng <- c(0, 7) |
|||
for (part in .x[8:10]) { |
|||
message(str(rng)) |
|||
amt <- floor((rng[2] - rng[1])/2) + 1 |
|||
if (part == "L") { |
|||
rng[2] <- rng[2] - amt |
|||
} else { |
|||
rng[1] <- rng[1] + amt |
|||
} |
|||
seat <- if (.x[10] == "R") rng[1] else rng[2] |
|||
(row * 8) + seat |
|||
}) %>% |
|||
sort() -> seats |
|||
reticulate::repl_python() |
|||
# --- Day 4: Passport Processing --- |
|||
# |
|||
# You arrive at the airport only to realize that you grabbed your North Pole Credentials instead of your passport. While these documents are extremely similar, North Pole Credentials aren't issued by a country and therefore aren't actually valid documentation for travel in most of the world. |
|||
# |
|||
# It seems like you're not the only one having problems, though; a very long line has formed for the automatic passport scanners, and the delay could upset your travel itinerary. |
|||
# |
|||
# Due to some questionable network security, you realize you might be able to solve both of these problems at the same time. |
|||
# |
|||
# The automatic passport scanners are slow because they're having trouble detecting which passports have all required fields. The expected fields are as follows: |
|||
# |
|||
# byr (Birth Year) |
|||
# iyr (Issue Year) |
|||
# eyr (Expiration Year) |
|||
# hgt (Height) |
|||
# hcl (Hair Color) |
|||
# ecl (Eye Color) |
|||
# pid (Passport ID) |
|||
# cid (Country ID) |
|||
# |
|||
# Passport data is validated in batch files (your puzzle input). Each passport |
|||
# is represented as a sequence of key:value pairs separated by spaces or newlines. |
|||
# Passports are separated by blank lines. |
|||
# |
|||
# Here is an example batch file containing four passports: |
|||
# |
|||
# ecl:gry pid:860033327 eyr:2020 hcl:#fffffd |
|||
# byr:1937 iyr:2017 cid:147 hgt:183cm |
|||
# |
|||
# iyr:2013 ecl:amb cid:350 eyr:2023 pid:028048884 |
|||
# hcl:#cfa07d byr:1929 |
|||
# |
|||
# hcl:#ae17e1 iyr:2013 |
|||
# eyr:2024 |
|||
# ecl:brn pid:760753108 byr:1931 |
|||
# hgt:179cm |
|||
# |
|||
# hcl:#cfa07d eyr:2025 pid:166559648 |
|||
# iyr:2011 ecl:brn hgt:59in |
|||
# |
|||
# The first passport is valid - all eight fields are present. The second |
|||
# passport is invalid - it is missing hgt (the Height field). |
|||
# |
|||
# The third passport is interesting; the only missing field is cid, so it |
|||
# looks like data from North Pole Credentials, not a passport at all! Surely, |
|||
# nobody would mind if you made the system temporarily ignore missing cid |
|||
# fields. Treat this "passport" as valid. |
|||
# |
|||
# The fourth passport is missing two fields, cid and byr. Missing cid is |
|||
# fine, but missing any other field is not, so this passport is invalid. |
|||
# |
|||
# According to the above rules, your improved system would report 2 valid |
|||
# passports. |
|||
# |
|||
# Count the number of valid passports - those that have all required fields. |
|||
# Treat cid as optional. In your batch file, how many passports are valid? |
|||
library(stringi) |
|||
library(tidyverse) |
|||
req_keys <- c("byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid") |
|||
input <- readLines("../input/04-01.txt") |
|||
# 04-01 ------------------------------------------------------------------- |
|||
split(input, findInterval(1:length(input), which(input == ""))) %>% |
|||
map_lgl(~{ |
|||
paste0(.x, collapse = " ") %>% |
|||
stri_match_all_regex("([[:alpha:]]{3}):([^ $]+)") %>% |
|||
pluck(1) %>% |
|||
.[,2] %>% |
|||
discard(`==`, 'cid') -> found |
|||
all(found %in% req_keys) & (length(found) == length(req_keys)) |
|||
# input <- readLines("/tmp/test.txt") |
|||
input <- readLines("../input/05-01.txt") |
|||
strsplit(input, "") %>% |
|||
map_dbl(~{ |
|||
rng <- c(0, 127) |
|||
for (part in .x[1:7]) { |
|||
amt <- floor((rng[2] - rng[1])/2) + 1 |
|||
if (part == "F") { |
|||
rng[2] <- rng[2] - amt |
|||
} else { |
|||
rng[1] <- rng[1] + amt |
|||
} |
|||
row <- if (.x[7] == "F") rng[1] else rng[2] |
|||
rng <- c(0, 7) |
|||
for (part in .x[8:10]) { |
|||
amt <- floor((rng[2] - rng[1])/2) + 1 |
|||
if (part == "L") { |
|||
rng[2] <- rng[2] - amt |
|||
} else { |
|||
rng[1] <- rng[1] + amt |
|||
} |
|||
seat <- if (.x[10] == "R") rng[1] else rng[2] |
|||
(row * 8) + seat |
|||
}) %>% |
|||
sum() |
|||
# --- Day 4: Passport Processing --- |
|||
# |
|||
# You arrive at the airport only to realize that you grabbed your North Pole Credentials instead of your passport. While these documents are extremely similar, North Pole Credentials aren't issued by a country and therefore aren't actually valid documentation for travel in most of the world. |
|||
# |
|||
# It seems like you're not the only one having problems, though; a very long line has formed for the automatic passport scanners, and the delay could upset your travel itinerary. |
|||
# |
|||
# Due to some questionable network security, you realize you might be able to solve both of these problems at the same time. |
|||
# |
|||
# The automatic passport scanners are slow because they're having trouble detecting which passports have all required fields. The expected fields are as follows: |
|||
# |
|||
# byr (Birth Year) |
|||
# iyr (Issue Year) |
|||
# eyr (Expiration Year) |
|||
# hgt (Height) |
|||
# hcl (Hair Color) |
|||
# ecl (Eye Color) |
|||
# pid (Passport ID) |
|||
# cid (Country ID) |
|||
sort() -> seats |
|||
max(seats) |
|||
# --- Part Two --- |
|||
# |
|||
# Passport data is validated in batch files (your puzzle input). Each passport |
|||
# is represented as a sequence of key:value pairs separated by spaces or newlines. |
|||
# Passports are separated by blank lines. |
|||
# Ding! The "fasten seat belt" signs have turned on. Time to find your seat. |
|||
# |
|||
# Here is an example batch file containing four passports: |
|||
# It's a completely full flight, so your seat should be the only missing |
|||
# boarding pass in your list. However, there's a catch: some of the seats at |
|||
# the very front and back of the plane don't exist on this aircraft, so they'll |
|||
# be missing from your list as well. |
|||
# |
|||
# ecl:gry pid:860033327 eyr:2020 hcl:#fffffd |
|||
# byr:1937 iyr:2017 cid:147 hgt:183cm |
|||
# Your seat wasn't at the very front or back, though; the seats with IDs +1 |
|||
# and -1 from yours will be in your list. |
|||
# |
|||
# iyr:2013 ecl:amb cid:350 eyr:2023 pid:028048884 |
|||
# hcl:#cfa07d byr:1929 |
|||
# |
|||
# hcl:#ae17e1 iyr:2013 |
|||
# eyr:2024 |
|||
# ecl:brn pid:760753108 byr:1931 |
|||
# hgt:179cm |
|||
# |
|||
# hcl:#cfa07d eyr:2025 pid:166559648 |
|||
# iyr:2011 ecl:brn hgt:59in |
|||
# |
|||
# The first passport is valid - all eight fields are present. The second |
|||
# passport is invalid - it is missing hgt (the Height field). |
|||
# |
|||
# The third passport is interesting; the only missing field is cid, so it |
|||
# looks like data from North Pole Credentials, not a passport at all! Surely, |
|||
# nobody would mind if you made the system temporarily ignore missing cid |
|||
# fields. Treat this "passport" as valid. |
|||
# |
|||
# The fourth passport is missing two fields, cid and byr. Missing cid is |
|||
# fine, but missing any other field is not, so this passport is invalid. |
|||
# |
|||
# According to the above rules, your improved system would report 2 valid |
|||
# passports. |
|||
# |
|||
# Count the number of valid passports - those that have all required fields. |
|||
# Treat cid as optional. In your batch file, how many passports are valid? |
|||
library(stringi) |
|||
library(tidyverse) |
|||
req_keys <- c("byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid") |
|||
input <- readLines("../input/04-01.txt") |
|||
# 04-01 ------------------------------------------------------------------- |
|||
split(input, findInterval(1:length(input), which(input == ""))) %>% |
|||
map_lgl(~{ |
|||
paste0(.x, collapse = " ") %>% |
|||
stri_match_all_regex("([[:alpha:]]{3}):([^ $]+)") %>% |
|||
pluck(1) %>% |
|||
.[,2] %>% |
|||
discard(`==`, 'cid') -> found |
|||
all(found %in% req_keys) & (length(found) == length(req_keys)) |
|||
}) %>% |
|||
sum() |
|||
reticulate::repl_python() |
|||
split(input, findInterval(1:length(input), which(input == ""))) %>% |
|||
map_lgl(~{ |
|||
paste0(.x, collapse = " ") %>% |
|||
stri_match_all_regex("([[:alpha:]]{3}):([^ $]+)") %>% |
|||
pluck(1) %>% |
|||
.[,2:3] %>% |
|||
as.data.frame() %>% |
|||
set_names(c("field", "value")) %>% |
|||
filter(field != "cid") -> found |
|||
if (!(all(found$field %in% req_keys) & (length(found$field) == length(req_keys)))) return(FALSE) |
|||
all(map2_lgl(found$field, found$value, validate)) |
|||
}) %>% |
|||
sum() |
|||
# What is the ID of your seat? |
|||
seats[which(diff(c(seats[1], seats)) > 1)] - 1 |
|||
reticulate::repl_python() |
|||
|
@ -0,0 +1,116 @@ |
|||
# --- Day 5: Binary Boarding --- |
|||
# |
|||
# You board your plane only to discover a new problem: you dropped your boarding |
|||
# pass! You aren't sure which seat is yours, and all of the flight attendants |
|||
# are busy with the flood of people that suddenly made it through passport |
|||
# control. |
|||
# |
|||
# You write a quick program to use your phone's camera to scan all of the nearby |
|||
# boarding passes (your puzzle input); perhaps you can find your seat through |
|||
# process of elimination. |
|||
# |
|||
# Instead of zones or groups, this airline uses binary space partitioning to |
|||
# seat people. A seat might be specified like FBFBBFFRLR, where F means "front", |
|||
# B means "back", L means "left", and R means "right". |
|||
# |
|||
# The first 7 characters will either be F or B; these specify exactly one of |
|||
# the 128 rows on the plane (numbered 0 through 127). Each letter tells you |
|||
# which half of a region the given seat is in. Start with the whole list of |
|||
# rows; the first letter indicates whether the seat is in the front |
|||
# (0 through 63) or the back (64 through 127). The next letter indicates which |
|||
# half of that region the seat is in, and so on until you're left with |
|||
# exactly one row. |
|||
# |
|||
# For example, consider just the first seven characters of FBFBBFFRLR: |
|||
# |
|||
# Start by considering the whole range, rows 0 through 127. |
|||
# F means to take the lower half, keeping rows 0 through 63. |
|||
# B means to take the upper half, keeping rows 32 through 63. |
|||
# F means to take the lower half, keeping rows 32 through 47. |
|||
# B means to take the upper half, keeping rows 40 through 47. |
|||
# B keeps rows 44 through 47. |
|||
# F keeps rows 44 through 45. |
|||
# |
|||
# The final F keeps the lower of the two, row 44. |
|||
# |
|||
# The last three characters will be either L or R; these specify exactly one |
|||
# of the 8 columns of seats on the plane (numbered 0 through 7). The same |
|||
# process as above proceeds again, this time with only three steps. L means |
|||
# to keep the lower half, while R means to keep the upper half. |
|||
# |
|||
# For example, consider just the last 3 characters of FBFBBFFRLR: |
|||
# |
|||
# Start by considering the whole range, columns 0 through 7. |
|||
# R means to take the upper half, keeping columns 4 through 7. |
|||
# L means to take the lower half, keeping columns 4 through 5. |
|||
# The final R keeps the upper of the two, column 5. |
|||
# |
|||
# So, decoding FBFBBFFRLR reveals that it is the seat at row 44, column 5. |
|||
# |
|||
# Every seat also has a unique seat ID: multiply the row by 8, then add the |
|||
# column. In this example, the seat has ID 44 * 8 + 5 = 357. |
|||
# |
|||
# Here are some other boarding passes: |
|||
# |
|||
# BFFFBBFRRR: row 70, column 7, seat ID 567. |
|||
# FFFBBBFRRR: row 14, column 7, seat ID 119. |
|||
# BBFFBBFRLL: row 102, column 4, seat ID 820. |
|||
# |
|||
# As a sanity check, look through your list of boarding passes. What is the |
|||
# highest seat ID on a boarding pass? |
|||
|
|||
library(tidyverse) |
|||
|
|||
input <- readLines("../input/05-01.txt") |
|||
|
|||
strsplit(input, "") %>% |
|||
map_dbl(~{ |
|||
|
|||
rng <- c(0, 127) |
|||
|
|||
for (part in .x[1:7]) { |
|||
amt <- floor((rng[2] - rng[1])/2) + 1 |
|||
if (part == "F") { |
|||
rng[2] <- rng[2] - amt |
|||
} else { |
|||
rng[1] <- rng[1] + amt |
|||
} |
|||
} |
|||
|
|||
row <- if (.x[7] == "F") rng[1] else rng[2] |
|||
|
|||
rng <- c(0, 7) |
|||
|
|||
for (part in .x[8:10]) { |
|||
amt <- floor((rng[2] - rng[1])/2) + 1 |
|||
if (part == "L") { |
|||
rng[2] <- rng[2] - amt |
|||
} else { |
|||
rng[1] <- rng[1] + amt |
|||
} |
|||
} |
|||
|
|||
seat <- if (.x[10] == "R") rng[1] else rng[2] |
|||
|
|||
(row * 8) + seat |
|||
|
|||
}) %>% |
|||
sort() -> seats |
|||
|
|||
max(seats) |
|||
|
|||
# --- Part Two --- |
|||
# |
|||
# Ding! The "fasten seat belt" signs have turned on. Time to find your seat. |
|||
# |
|||
# It's a completely full flight, so your seat should be the only missing |
|||
# boarding pass in your list. However, there's a catch: some of the seats at |
|||
# the very front and back of the plane don't exist on this aircraft, so they'll |
|||
# be missing from your list as well. |
|||
# |
|||
# Your seat wasn't at the very front or back, though; the seats with IDs +1 |
|||
# and -1 from yours will be in your list. |
|||
# |
|||
# What is the ID of your seat? |
|||
|
|||
seats[which(diff(c(seats[1], seats)) > 1)] - 1 |
@ -0,0 +1,43 @@ |
|||
import math |
|||
import numpy as np |
|||
|
|||
with open("../input/05-01.txt") as f: |
|||
input = f.read().splitlines() |
|||
|
|||
def partition(seq, lb, ub, trigger, ret): |
|||
|
|||
for idx, part in enumerate(seq): |
|||
amt = math.floor((ub - lb)/2) + 1 |
|||
if (part == trigger): |
|||
ub -= amt |
|||
else: |
|||
lb += amt |
|||
|
|||
return(ub if (seq[-1] == trigger) else lb) |
|||
|
|||
|
|||
def get_seat(x): |
|||
return( |
|||
(partition(x[0:7], 0, 127, "F", "F") * 8) + |
|||
partition(x[7:10], 0, 7, "L", "L") |
|||
) |
|||
|
|||
res = [ get_seat(bpass) for bpass in input ] |
|||
|
|||
# 05-01 |
|||
|
|||
res.sort() |
|||
|
|||
max(res) |
|||
|
|||
# 05-02 |
|||
|
|||
res.insert(0, res[0]) |
|||
idx = np.where(np.diff(res) > 1) |
|||
res.pop(0) |
|||
res[idx[0][0]] - 1 |
|||
|
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1,814 @@ |
|||
BBFFFBFRLL |
|||
FBBBBBFLRL |
|||
FBBFBBBLRR |
|||
FFBBFFBLLR |
|||
FFBBFFFRLL |
|||
BBFBBFFLRL |
|||
BBFFBBBRLR |
|||
BFFBFBFLRL |
|||
FBFFFBBRLL |
|||
FFFBFBBRLL |
|||
BBFBBFFRRR |
|||
FBFFBFFRRR |
|||
FFBBBFBLLL |
|||
BBFBFBFRLL |
|||
BBFBFBBLLL |
|||
BFFBBBFRLL |
|||
BFBBFFBRLR |
|||
FFBBFFFLRL |
|||
BFBFFBBLLR |
|||
BFFFFFBLLL |
|||
FBBFFFFLLR |
|||
BBFBFBBRLL |
|||
BFBBBFBRRR |
|||
BFFBBBBRLL |
|||
BFBBBFFRRR |
|||
FFBFFBBRRR |
|||
BFFFBBFLRL |
|||
FFBFFFBRRL |
|||
FFBFBBFLRR |
|||
FFBBBBFLRL |
|||
BFFFBFFLLL |
|||
FBFBBBFRLR |
|||
BFBFBBFRLR |
|||
FBBFBFBLRL |
|||
BBFFBFBRRR |
|||
FBBBFBFRLR |
|||
BBFBBBBRLL |
|||
FFBBFFBRRL |
|||
FBFFFBBLRR |
|||
FBFFBBFRRR |
|||
FBFBBFFRLL |
|||
FBFBBBBRLL |
|||
FBBFBFFRRL |
|||
BBFBBFFLLL |
|||
FBBBFFBLRL |
|||
FFBFFBFLRL |
|||
BBFBFFBLLR |
|||
BBFFBBFRRR |
|||
FFBFBFBLLL |
|||
FBBBBFBLRR |
|||
BFFFBBBLRR |
|||
BFFBBFBLLL |
|||
FBFFBBFLRR |
|||
BFBBBBFLRL |
|||
BBFFFFBLLL |
|||
BFFFBBBRRR |
|||
FBFFFFFLLL |
|||
FBFBBFFLRR |
|||
FFBFBFBRRL |
|||
FBFBBFFLLL |
|||
FBFFBFBRLL |
|||
FBFFBFBLLR |
|||
BFFBFFFLRL |
|||
FFFBBBBLRR |
|||
BFFFFBBRLL |
|||
BFFFFFFRLL |
|||
BFBBFFFLLR |
|||
BFFFFBFRLL |
|||
BFFBFFBRRL |
|||
FBBFBBBRRR |
|||
FFBBFBFRRR |
|||
BBFBBFFLLR |
|||
FBFBFBFLRR |
|||
BFBFBFBRLR |
|||
FBBFFBFRRR |
|||
BBFBFFBRLR |
|||
BBFBBBFRLR |
|||
FFBFBBBRRL |
|||
BFBFBBBLLL |
|||
FBBBFBFRRL |
|||
FFBBFBFRLL |
|||
FFBFBBFRLR |
|||
FBBFBBFRLL |
|||
FFBFBFFLRL |
|||
FFBFFFFLLR |
|||
FFFBBFBLLL |
|||
BBFBBFBLRL |
|||
FBBFBBFLRR |
|||
FFFBBBBRLL |
|||
BBFBFBBLRR |
|||
FFFBBFBLRL |
|||
FBBFBFFLLR |
|||
FFBBFFBLRL |
|||
BBFBFFFRLL |
|||
FBBBFFFRRL |
|||
FBFFBFFLRR |
|||
FBBBBBFRRL |
|||
BFFFBFBLLL |
|||
FBFBBFFLRL |
|||
FBBFBBBRRL |
|||
BFBBBFBLRL |
|||
BFBBFBBRRR |
|||
FBBBBBBLRR |
|||
FFBFFBBLRL |
|||
FBBFFBBRLR |
|||
FBBBFBFLLR |
|||
BBFFBBFLLR |
|||
BBFBBFFRLL |
|||
FFBFFBFLLR |
|||
FBFBFFBRRL |
|||
FFBBBFFRLR |
|||
BFBBFFBLLR |
|||
BFFBBBBLLR |
|||
BBFBFBFLLL |
|||
BFFBBFFRRL |
|||
FFFBBBFRLR |
|||
FFBBBFBRLR |
|||
BFBFFBBRLL |
|||
FFBFBFBRLL |
|||
FBFFFFFLLR |
|||
FBBBFBBLRR |
|||
FBBBFBBLLL |
|||
BFFBBBFRRR |
|||
BFBFBFFLLR |
|||
FBBBBFBRLR |
|||
BFBBFFFRRR |
|||
BFBBBFFRRL |
|||
FFFBFBFLRL |
|||
FBBBBFFRRL |
|||
FBBBBBFLRR |
|||
BFFFBBFRRR |
|||
FBFBFFBLLR |
|||
FBFBFBFRLR |
|||
FFBBFFFRLR |
|||
FBFBBFBLRL |
|||
BBFBFFBRRL |
|||
FFBFBBFRLL |
|||
FBBFFBFLLR |
|||
FBBBBFBRRL |
|||
BFBBBBBRRL |
|||
BBFFFFFLRR |
|||
BBFFBBBLRL |
|||
BFFFFBBLRR |
|||
FBBFBFFLLL |
|||
FFFBBFBLLR |
|||
FBBBFFBLLL |
|||
BFFFBFBRRR |
|||
FFBFFFBRLR |
|||
BBFFBFFLRR |
|||
BBFFBFBRLL |
|||
FFBFBBBLRL |
|||
FBFBFBBRRR |
|||
BFBBFBFLLL |
|||
FFFBBBFLRR |
|||
BBFFBFBRRL |
|||
BFFFFFFLRL |
|||
BBFBFBBRRL |
|||
BBFBFFFLLR |
|||
FBBFFFBRRR |
|||
FFBBBBFRRR |
|||
FFBBFBBLLL |
|||
BFFBFFBRLL |
|||
BBFBFFFLRR |
|||
FBFBBFBLLR |
|||
FFBFBFBRRR |
|||
BBFFBFBLLL |
|||
FBBBBFFLRL |
|||
FBFBFFFLRR |
|||
BBFBBFBLRR |
|||
BFBBBFBLLL |
|||
FBFBFFFRRL |
|||
BBFFBBFRLL |
|||
BFFFFBFLRR |
|||
FBBBFBBRRR |
|||
BFFBFBFRLR |
|||
FBBFBFBLLR |
|||
FFBFFBBLLR |
|||
BFFFFBBLLL |
|||
FFFBBBFRLL |
|||
FBFFFFFRRL |
|||
BFFFBBFLRR |
|||
BFBFBBBLLR |
|||
BBFFBFFRRR |
|||
FBFBBBFRRL |
|||
FBFBBBBRLR |
|||
FBBBBFBLLR |
|||
BBFFFFBLRR |
|||
BFBFBFBLRR |
|||
BFBFBFFLLL |
|||
FFBFBFFRLL |
|||
FFBFFFFRRR |
|||
FBBBBFBLRL |
|||
FBBBBBBLRL |
|||
BFFBFBBRLR |
|||
FFFBFBFLLL |
|||
FFBBFBFLRR |
|||
BBFFFBBLLL |
|||
FBBFBFFRLL |
|||
BFBFFBFLRL |
|||
FBFBBBBLLL |
|||
BFFBBBFLRL |
|||
BBFFBBFRLR |
|||
FBFBFFFLLR |
|||
BFBFFFFRLL |
|||
BBFFBFFLRL |
|||
BFBFFFFLLR |
|||
FFBBBBBRRL |
|||
BFFFFFFLLL |
|||
BFFBFFBLRR |
|||
FFBFFFBLRL |
|||
FFBBFBBRLL |
|||
FBFBBBFRLL |
|||
FBBBFFFRRR |
|||
BFFBFFFLLR |
|||
FBFBFBFLRL |
|||
BBFFBFBRLR |
|||
BFBFFBBRRL |
|||
BFFBBBBRLR |
|||
BFBFBFBLRL |
|||
FFBFBFFLLR |
|||
FFFBBFBRLL |
|||
BFBBFFFRLR |
|||
BFBBFFBLRR |
|||
FFFBBBBRRL |
|||
FBBFBFFRLR |
|||
BFBBFBFLRL |
|||
FBFBFBFRLL |
|||
FBBFFFFRRR |
|||
BBFFFBFRLR |
|||
FFBBBFBRLL |
|||
FFBFBFFRLR |
|||
BFFFFFBRRR |
|||
FBBBBFBRLL |
|||
FBFFBFBLRR |
|||
FBBBBBBRRL |
|||
FBFBBBFRRR |
|||
FFBFBBBRLR |
|||
FBBBBBFLLL |
|||
BFFBFBFRRR |
|||
BFFBFFFLRR |
|||
BFFBFFBRRR |
|||
BFBFBFBRLL |
|||
BBFFBFFRLR |
|||
BFFFFBFRRL |
|||
FBFFBBFLLL |
|||
FBFBFFBRLR |
|||
BBFBFFBLLL |
|||
BBFBFBBLRL |
|||
BBFFBBBLLR |
|||
BBFBFFFLRL |
|||
FBFFFBFRRR |
|||
BBFFBBBRLL |
|||
BBFFFBFLRL |
|||
FBFFBFBRRL |
|||
BFFFFFFRRR |
|||
FBFFFFBRLR |
|||
BFBBBBBLRL |
|||
FBBFFFBLRR |
|||
BFFBFBFLLR |
|||
FBBFFBFLRR |
|||
BFFBBFBRRR |
|||
BFBBFFFLRL |
|||
FFBBBFBLRL |
|||
FFFBFBBLRL |
|||
BBFBFFFRRL |
|||
FFBFFFFRRL |
|||
BFBBBBBRLL |
|||
FBBFBFBLLL |
|||
FBBFBFFLRL |
|||
BFFBBFFRRR |
|||
BBFFFBBRRR |
|||
BFFFBFBLRL |
|||
BFFFFBBRRR |
|||
FBBFFFFRLR |
|||
BFBFBBBRLR |
|||
FBFBFBBRLR |
|||
FBBBFBBRLL |
|||
FFFBFBBRRL |
|||
BFBBBBBRLR |
|||
FFBFBBBRRR |
|||
BFFFFBFLLL |
|||
BFBFBFFRRR |
|||
BBFBBBFRRL |
|||
FFBFFFBLLR |
|||
BFBBBBFRRL |
|||
BBFFFBBLRR |
|||
FFBFBBBLLL |
|||
BFBBBFBRLR |
|||
FFBBFFBRRR |
|||
BFBFBBFLRR |
|||
BFBFFBFRRL |
|||
BBFFBFBLRR |
|||
BBFBBBBLRR |
|||
FFBBBFFRRL |
|||
FFFBBFFLRL |
|||
FFFBFBFRRR |
|||
BBFBBFBRRR |
|||
FFFBFBFRRL |
|||
BFBBFFBLLL |
|||
FBFBFFBLRL |
|||
FBBFBFFLRR |
|||
BBFBFFBRRR |
|||
FBFFBBBRRL |
|||
BFFBFFBLRL |
|||
FFFBBBFRRL |
|||
BFFFBFFLRR |
|||
FFBBBBFRRL |
|||
FFFBFBBLLR |
|||
BBFBFBFRRL |
|||
BFBFBFFLRL |
|||
FBFBBBFLRL |
|||
BFBBBBBLLR |
|||
FBFFFFFRLL |
|||
BFBFFBFRLR |
|||
BBFFBFBLRL |
|||
FBFFBFBRRR |
|||
BBFFFBFRRL |
|||
FBBFFFBLLL |
|||
BBFFFFBRLR |
|||
BFFBFBBRRL |
|||
FBFFFFBLRL |
|||
BBFFFFFRLL |
|||
BFFBFBBLRL |
|||
BBFFFFBLRL |
|||
BFFBBBBLRL |
|||
FBBFBFBRRL |
|||
BFFBFFFLLL |
|||
BFBFBBBRRR |
|||
FBBBBBBLLL |
|||
BFBBBFBRRL |
|||
FFBFFBBLLL |
|||
FFBBBBBRRR |
|||
BBFBBFBRLR |
|||
BFBBFFBLRL |
|||
FBFBBBBRRL |
|||
FFFBFBFLLR |
|||
BFFBBBBLLL |
|||
BFFFBBFRRL |
|||
FBBBFFBRRL |
|||
FFBFFBFLRR |
|||
FBFBFBBRRL |
|||
BBFFFBBLRL |
|||
FFBBFFBRLR |
|||
BFBFFBBRLR |
|||
BFBBFBBLRL |
|||
BFBBFFFRLL |
|||
BFFFFFBLRR |
|||
FFBBBBBLRR |
|||
FFFBBBBRRR |
|||
BBFBFFFRRR |
|||
FBFBBFBRRR |
|||
FBBFFFFLRL |
|||
FBFFBBBLRR |
|||
FBBBBFFRLR |
|||
FBBFFFFLRR |
|||
FBFFFFBLLR |
|||
FFBFBFFRRL |
|||
FFBBFFFLLR |
|||
BFFFFFFLRR |
|||
BBFFFFFRLR |
|||
FBFFFFBLLL |
|||
FBFBFFBRRR |
|||
FBBBBFFLRR |
|||
BFBBBBFRLL |
|||
BBFBFBFRLR |
|||
FFBFBBFRRR |
|||
FBFFFBBRLR |
|||
FFBFBFBLRL |
|||
FBBFFBFRLR |
|||
FFBBFBFLRL |
|||
FBBBBBBRRR |
|||
FFFBBFFRLL |
|||
BFFBFBFRRL |
|||
FBFFBBBRRR |
|||
FBFBFFBRLL |
|||
FFBFFFFLLL |
|||
FBFFBFFLRL |
|||
FFBBBFBLRR |
|||
FFFBBFFLRR |
|||
BBFFBFFLLR |
|||
FBFBBFBLLL |
|||
FFBBFBBRRL |
|||
BFFBBFFRLL |
|||
FFFBFBBRLR |
|||
BFFFFFFRRL |
|||
FBBBFBFLLL |
|||
FFBFBBFRRL |
|||
FBFBBFFRRL |
|||
BBFBFFFLLL |
|||
FBFFBBBLRL |
|||
BFBFFFBLLL |
|||
BFFBFFBRLR |
|||
BFFFBFFRLL |
|||
FFBFBBBRLL |
|||
FBBFBFBLRR |
|||
BBFBBFBRLL |
|||
FFBFBFFRRR |
|||
BBFFFFBRRL |
|||
BFFBBBBLRR |
|||
BFBFBFBRRL |
|||
BFFBBFBRLL |
|||
FBBFFBFRLL |
|||
FBFBBFFRLR |
|||
BFFBBBFLRR |
|||
BFFBBFBLRR |
|||
FFBFBFBLRR |
|||
FFBBBBFRLL |
|||
BFBFFBFLLL |
|||
FFFBBFFLLR |
|||
BFBFBFBRRR |
|||
BFFFBBBRRL |
|||
FFFBFFBRRR |
|||
FBFBBFBRRL |
|||
BBFBFBFRRR |
|||
BFFBFBFRLL |
|||
FBBBFFFRLR |
|||
FBBFFFBRLR |
|||
FBFBFBFLLR |
|||
BBFFBBFLLL |
|||
BFBBBFBRLL |
|||
FBFBBBBLRR |
|||
FBBFFBBLLL |
|||
BFFBBFBRLR |
|||
BFFFFFBRLR |
|||
FFFBBBBLRL |
|||
FFFBBFFRRR |
|||
BFFFFFBLRL |
|||
FBBBBFFLLR |
|||
BFBFFFBRLR |
|||
FBFBBFBLRR |
|||
FBBBFFFLLR |
|||
FBBBFFFLRL |
|||
BBFBBFFRLR |
|||
BFFBBFBRRL |
|||
BFBFBBBRLL |
|||
BBFBBFBLLL |
|||
BFBBFBFRRR |
|||
BBFFFBBRLL |
|||
FBBFBFBRLR |
|||
FFBBFFBLRR |
|||
FBFBBBBLLR |
|||
FBFFFBFRLL |
|||
FFFBBBBLLR |
|||
FBBFFFFRLL |
|||
BFFFFBFLLR |
|||
BBFBFBFLLR |
|||
FBBFFBBRLL |
|||
BFBBBBFRRR |
|||
FFFBBBFLRL |
|||
BFFFBBBLRL |
|||
FBBFFBFLRL |
|||
BFFBBBFRRL |
|||
FFBFFFBRRR |
|||
BFBFBBBRRL |
|||
FBFBFBBLRL |
|||
FFBBFFFLRR |
|||
FBBFBFBRLL |
|||
BBFBFBBRLR |
|||
BFBFFFBRLL |
|||
BFBFBBFLRL |
|||
BFBBFBBLRR |
|||
BFFFBBFRLL |
|||
BFFFFFFLLR |
|||
FFFBBFBRRR |
|||
FFBBFFBRLL |
|||
FBFFBFFLLL |
|||
BFFFBBBLLR |
|||
FBFFBBFRRL |
|||
FBBFBBBLLL |
|||
FBFBFBBRLL |
|||
FBBBFBFLRL |
|||
FFBFBBBLLR |
|||
FFBBBFBRRR |
|||
FFFBBFBLRR |
|||
FFBBFFFRRR |
|||
BFBBBBFLRR |
|||
FFBBBBBRLR |
|||
FBFBBFBRLR |
|||
FFBBBFFRLL |
|||
FBBFBFFRRR |
|||
FBFBFBFRRL |
|||
FBFFFFFRLR |
|||
FBBFFFBRLL |
|||
FBBFBBFRRR |
|||
BFBBBBBLLL |
|||
BFBFBFFRLR |
|||
FBFFFBBLRL |
|||
BBFFBBFLRR |
|||
FFBBFBFLLL |
|||
BFFFFBBLLR |
|||
FFBBFBBLRL |
|||
FBBBFFBLRR |
|||
BBFFFBFLRR |
|||
FFBFFFFLRL |
|||
FBFFBBFRLR |
|||
FBBFBBBRLR |
|||
FFBFFFFRLR |
|||
FBBBBBBRLR |
|||
BFFBFFBLLL |
|||
FBBBFBFLRR |
|||
BFBFFBBRRR |
|||
BFFFFFBLLR |
|||
BBFFFFBRLL |
|||
FBBFFBBRRR |
|||
FFFBBFBRLR |
|||
BFFBFFFRRR |
|||
BBFFBBFRRL |
|||
FFBBFBFRLR |
|||
BFFFBBBRLR |
|||
FFBFFBFRRL |
|||
FFBFFBBRRL |
|||
BFBFFFFLLL |
|||
BFBFFFBLRR |
|||
BBFFFBBLLR |
|||
BFBFBBBLRR |
|||
BFFBBFFLRL |
|||
FBFBFFFLRL |
|||
BBFFBFFRRL |
|||
FBBBBFBLLL |
|||
FFFBBBFLLR |
|||
BBFBBBBLLL |
|||
FFFBBFFRLR |
|||
BBFBFBBRRR |
|||
FFBBBBFRLR |
|||
BFFFBFBRLL |
|||
FFFBFBFRLR |
|||
BFBBBFFLLR |
|||
BFFBBBFLLL |
|||
BFFBBBBRRR |
|||
FBBBFFFLRR |
|||
FFBFBBFLRL |
|||
FFBBBBFLLL |
|||
FBFFFFBRRL |
|||
BFBFFBBLRR |
|||
BBFBBFFLRR |
|||
BFBBBBFRLR |
|||
BFFBFBFLRR |
|||
FFBBFBBLRR |
|||
BFBFBFFLRR |
|||
FFBBBFFLRL |
|||
FBFFBFFRLR |
|||
FFBBBFBRRL |
|||
FBBFFBBLLR |
|||
FFBBFBFLLR |
|||
FFBFFFFLRR |
|||
BFFBBFBLRL |
|||
BFBFFBFLLR |
|||
BFBFBBBLRL |
|||
FFBBFBBRRR |
|||
FFBFFBFRLR |
|||
FBBBFBBRLR |
|||
FFFBBBBLLL |
|||
BFFFBFFRLR |
|||
FBFFBBFLRL |
|||
FBBBBFFRRR |
|||
BBFBBBFLLL |
|||
BFFFFFBRLL |
|||
BFFBFFBLLR |
|||
BFFBBFFLLR |
|||
BFFBBFBLLR |
|||
FBFFFFBRLL |
|||
FBBFBBBLRL |
|||
BBFFFBBRLR |
|||
BBFBFFFRLR |
|||
FBFBFBFLLL |
|||
FBFFFFFLRR |
|||
FBFFBFBLLL |
|||
FBBFFFBRRL |
|||
FBFFFBFLLR |
|||
BFFFFBBRRL |
|||
BBFBBBFRRR |
|||
BBFFFFFRRL |
|||
BFBFFFBLRL |
|||
FBBFFBBRRL |
|||
FBFFFBFRRL |
|||
BFFFBFFLLR |
|||
FFBBFFFRRL |
|||
FFBFFFBLRR |
|||
BFFBFFFRLR |
|||
FFFBBFFLLL |
|||
BFFFBFBRRL |
|||
FFBBBFFRRR |
|||
BFBBBFBLLR |
|||
BFBBFBFLRR |
|||
FBFFFFBLRR |
|||
BFFFFBFRRR |
|||
BFBFFBFRLL |
|||
FBFFFFBRRR |
|||
BFBFBBFLLR |
|||
BFBBBFFLRL |
|||
BFBBFFBRRL |
|||
FBFFBBFLLR |
|||
BFBFFBFRRR |
|||
FFFBFBBLRR |
|||
FBBBBBFLLR |
|||
FBBFBBFLLL |
|||
BFFBFBBRRR |
|||
FBFFBFFRLL |
|||
BFFBBFFRLR |
|||
FFBFBFBLLR |
|||
FBFBFFFRRR |
|||
FBFFFBBLLL |
|||
BFBFFBFLRR |
|||
FFBFFBBLRR |
|||
FFBFBBFLLR |
|||
FFBBBBBLLL |
|||
BFFBBBBRRL |
|||
FFBBBFFLLR |
|||
FFBBBBBLLR |
|||
FBBBBBBLLR |
|||
FBFBFFBLRR |
|||
BFFBBFFLRR |
|||
FBBBFFFRLL |
|||
BFBFBBFLLL |
|||
FBFFFFFLRL |
|||
BFBBBFFRLL |
|||
FFBBBFFLRR |
|||
BBFFBBBLRR |
|||
BFBBFBFRLR |
|||
BBFFFFFRRR |
|||
BBFBFFBLRL |
|||
BFFFFBFRLR |
|||
FBFFBFFLLR |
|||
FFBBBBBRLL |
|||
BFFBFFFRLL |
|||
BFFBFBFLLL |
|||
BFFFBBBLLL |
|||
BFBFFFFRRR |
|||
BFFFFBBRLR |
|||
BFBBBBBLRR |
|||
BFBFFFBLLR |
|||
BFBBFBBLLL |
|||
FFBBFFFLLL |
|||
FBBBFBFRLL |
|||
FBBFBFBRRR |
|||
BFFFBFFRRL |
|||
BBFBBFBLLR |
|||
FFBFBFFLRR |
|||
BBFBBBFLRR |
|||
FBBFFBFRRL |
|||
BFFFBFFRRR |
|||
FFFBFBFLRR |
|||
FBBFFFFLLL |
|||
FBFFFFFRRR |
|||
FBFBFBBLLL |
|||
BBFFFBFRRR |
|||
BFFBFFFRRL |
|||
BFBFBBFRLL |
|||
FFBBBFFLLL |
|||
BBFFBBBRRR |
|||
BFBFFBBLLL |
|||
FFBFFBFLLL |
|||
FFFBBBFLLL |
|||
FBFFBBBLLR |
|||
BBFFBFBLLR |
|||
FBBBFBBLRL |
|||
FFBFFFBRLL |
|||
BBFBFBFLRL |
|||
BBFBFFBLRR |
|||
BBFFFFFLRL |
|||
BFBBBBFLLR |
|||
FBFFFBFRLR |
|||
FBBBBBBRLL |
|||
BFFFBFBRLR |
|||
BFBBFFBRLL |
|||
FFFBFBBLLL |
|||
FBFBBBFLLL |
|||
FBBBFBBRRL |
|||
FBFFFBFLLL |
|||
FBBBBBFRLL |
|||
BFFFFFFRLR |
|||
BFFFBBFLLL |
|||
FBBBBFFLLL |
|||
FFBFFBFRLL |
|||
FBFFBFBRLR |
|||
BFBBFBBRRL |
|||
BFFBFBBRLL |
|||
BFBBFBFRRL |
|||
FFBFFBFRRR |
|||
BBFBFFBRLL |
|||
BFFBBBFRLR |
|||
FBBFFFFRRL |
|||
FBFBBBFLLR |
|||
BBFFBBBRRL |
|||
BFBBFFFLRR |
|||
BFFBFBBLRR |
|||
FFFBBBFRRR |
|||
FBBBFFBRLL |
|||
BFBBFBFLLR |
|||
FFBBFBFRRL |
|||
BFBBFBFRLL |
|||
BFBBFBBRLL |
|||
FFBFFFFRLL |
|||
FBFFBFBLRL |
|||
FBFBFFFLLL |
|||
FBBFBBFRLR |
|||
BBFFFBFLLL |
|||
FBBBFFBLLR |
|||
BFFFBFFLRL |
|||
BFFFBFBLRR |
|||
BBFBBBBLRL |
|||
FBFFFBBRRR |
|||
BFFBFBBLLL |
|||
BFFFFBBLRL |
|||
FBFBBBFLRR |
|||
FFFBBFBRRL |
|||
BFBBBFFRLR |
|||
BBFFFBFLLR |
|||
FBBBBBFRRR |
|||
BFFFBFBLLR |
|||
BFBFBFBLLL |
|||
FBBBFFBRRR |
|||
FFBBBBFLRR |
|||
FBBFBBFRRL |
|||
FFBBFBBRLR |
|||
BBFBBBFLRL |
|||
BBFFFFBLLR |
|||
FFBFFBBRLL |
|||
BFBFFFFLRR |
|||
FBFFFBBLLR |
|||
FBBFFFBLRL |
|||
FBFBBBBRRR |
|||
FFBFFBBRLR |
|||
BFBBFBBLLR |
|||
FFBBFFBLLL |
|||
BBFBFBFLRR |
|||
BBFBBBFLLR |
|||
FBBBBFFRLL |
|||
FFFBBFFRRL |
|||
FFFBFBBRRR |
|||
BFBFFFFLRL |
|||
BFFBFBBLLR |
|||
FFFBFBFRLL |
|||
FBBBFBFRRR |
|||
BBFFFFFLLL |
|||
FBBBFBBLLR |
|||
FFBBBBBLRL |
|||
BBFFBFFRLL |
|||
FBBBFFFLLL |
|||
FBFFBBBRLL |
|||
FBBFFBBLRL |
|||
BFBFBFFRLL |
|||
FBFBFFFRLR |
|||
BBFFFFFLLR |
|||
BFFFBBFLLR |
|||
FFBFBBFLLL |
|||
FBFBBFFRRR |
|||
FFBBFBBLLR |
|||
BBFBFBBLLR |
|||
FFBFBFBRLR |
|||
FFBFBFFLLL |
|||
FBBFBBFLLR |
|||
BFBFBFBLLR |
|||
FBBFBBFLRL |
|||
BFBFBBFRRR |
|||
FBFBFFBLLL |
|||
BFBBBFBLRR |
|||
BFBFFFBRRR |
|||
FBFBFBBLRR |
|||
BFBBFFBRRR |
|||
FBFFFBFLRL |
|||
BFBBBFFLLL |
|||
FBFFBFFRRL |
|||
BFBFFFFRLR |
|||
BFBBBBFLLL |
|||
FBBFBBBRLL |
|||
BFBBBFFLRR |
|||
FBFBFBBLLR |
|||
FFFBBBBRLR |
|||
BFBFFFBRRL |
|||
BFBFBFFRRL |
|||
BBFBBBFRLL |
|||
FFBFFFBLLL |
|||
BFFFBBBRLL |
|||
BBFFBBFLRL |
|||
BBFBBBBLLR |
|||
FFBBBBFLLR |
|||
FBFFBBBRLR |
|||
FBFFBBBLLL |
|||
FBBFFFBLLR |
|||
FBBFBBBLLR |
|||
BFBBFBBRLR |
|||
BBFFBBBLLL |
|||
FBFBFBFRRR |
|||
BFFFFBFLRL |
|||
BBFBBFBRRL |
|||
BFBBFFFRRL |
|||
BFBFFFFRRL |
|||
BFBFFBBLRL |
|||
FBBBFFBRLR |
|||
FBBBBFBRRR |
|||
FFFBFFBRRL |
|||
BBFFFBBRRL |
|||
BBFFBFFLLL |
|||
FBFFFBBRRL |
|||
BBFFFFBRRR |
|||
BFBFBBFRRL |
|||
FBBFFBFLLL |
|||
FBFFFBFLRR |
|||
FBFBFFFRLL |
|||
FBFBBBBLRL |
|||
FBBFFBBLRR |
|||
BFFFBBFRLR |
|||
FBFBBFBRLL |
|||
BFFBBFFLLL |
|||
BFBBFFFLLL |
|||
BFBBBBBRRR |
|||
FFBBBFBLLR |
|||
BFFFFFBRRL |
|||
FFBFBBBLRR |
|||
BBFBBFFRRL |
|||
FBFBBFFLLR |
|||
FBFFBBFRLL |
|||
FBBBBBFRLR |
Loading…
Reference in new issue