Advent of code 2015/3
Ajax Direct

Answer

Part 1 :
Part 2 :
// ==================================================
// > PART 1
// ==================================================
$solution_1 = xy([0, 0])->directions($input->chars()->map("direction"))->getVisitedCount();

// ==================================================
// > PART 2
// ==================================================
$santa = xy([0, 0]);
$robot = xy([0, 0]);

$input->chars()->chunk(2)->each(fn ($chunk) =>
    $santa->direction(direction($chunk[0])) && $robot->direction(direction($chunk[1]))
);

$santa->history = $santa->history->merge($robot->history);
$solution_2 = $santa->getVisitedCount();