Advent of code 2019/21
Ajax Direct

Answer

Part 1 :
Part 2 :
function run($program) {
    global $input;
    $robot = (new Intcode($input, set($program)->reduce(function ($carry, $line) {
        return array_merge($carry, array_map("ord", str_split($line)), [10]);
    }, [])));
    $robot->run();
    return $robot->output;
}

// ==================================================
// > PART 1
// ==================================================
$solution_1 = run([
    // Target floor that is just after a hole
    "NOT C T",
    "OR T J",

    // Always jump if there a hole in A
    "NOT A T",
    "OR T J",

    // Never jump if there is a hole in D
    "AND D J",

    "WALK"
])->last();

// ==================================================
// > PART 2
// ==================================================
$solution_2 = run([
    // Jump if B or C are holes
    "NOT B J",
    "NOT C T",
    "OR T J",

    // Never jump if there is a hole in D or H
    "AND D J",
    "AND H J",

    // Always jump if there a hole in A
    "NOT A T",
    "OR T J",

    "RUN"
])->last();