Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
dTub
Скачать

Xah Ep741 Wolfram Language, Advent of Code 2025, Day 7

Автор: Xah Lee

Загружено: 2026-01-09

Просмотров: 114

Описание:

Advent of Code 2025, Day 7, using Wolfram Language (0:05).
The problem involves a "tachyon manifold" diagram, where a beam originating from 'S' travels downward and splits into two (left and right) upon encountering a splitter character ('^').
Problem is to compute the total number of times the beam splits (1:13:35).

Lee first analyzes the problem by reading the description and understanding the beam's behavior (8:10). He then devises a step-by-step algorithm (27:10).

Input Processing: Convert the raw text input into a matrix for easier manipulation (30:05). Replace the empty spaces ('.') with 0 and splitters ('^') with 1 to simplify calculations (36:40).

Beam State Management: Maintain a list of the current beam positions (indexes) (35:55). The initial state is the position of 'S' in the first row (41:59).

Iteration and Comparison: Loop through each row of the matrix, comparing the current beam positions with the splitter positions in the next row (21:53).

Splitting and Merging Logic:

If a beam's position matches a splitter's position, that beam splits into two new positions: (original_position - 1) and (original_position + 1) (26:36, 1:00:28).

Beam merges are handled by removing duplicate positions from the list of beam states (22:33, 1:12:12).

Edge Cases: Lee notes that the specific puzzle input does not require handling beams going off the grid (25:24).

Wolfram Language Implementation: demo use functions like StringReplace (37:04), Characters (31:14), Position (49:28), Intersection (57:18), Map (58:24), and Flatten (1:07:56) to implement the logic.
Heart of the solution is the function f_new_state that takes the current beam state and a row, returning the next beam state (1:14:49).

Final Calculation: The Fold function is used to apply f_new_state iteratively across all rows, and the final answer is the Length of the resulting beam state list (1:21:04).

Towards the end, he debugs a minor issue related to function definition, highlighting the iterative process of coding (1:23:19).

Two major problems that costed 30 minute each, is 2 logical errors in our algorithm. One, we forgot to keep the beams that did not collide. Two, we forgot to remove the beams that did collide.

Notes at
http://xahlee.info/talk_show/xah_talk...
If browser says security error, that is because it auto changes URL from HTTP to HTTPS.
It's a way to censor 22 million old websites.
Remove the S in HTTPS.
Or use brave browser or safari.

Xah Ep741 Wolfram Language, Advent of Code 2025, Day 7

Поделиться в:

Доступные форматы для скачивания:

Скачать видео mp4

  • Информация по загрузке:

Скачать аудио mp3

Похожие видео

Xah Ep744 Wolfram Language, Advent of Code 2025, Day 7, part 2

Xah Ep744 Wolfram Language, Advent of Code 2025, Day 7, part 2

Xah Ep736 Wolfram Language, Advent of Code 2025, Day 6

Xah Ep736 Wolfram Language, Advent of Code 2025, Day 6

LLM Testing for Beginners: Week 1 Project Walkthrough | Week 1 of 52

LLM Testing for Beginners: Week 1 Project Walkthrough | Week 1 of 52

Программирование на ассемблере без операционной системы

Программирование на ассемблере без операционной системы

Код работает в 100 раз медленнее из-за ложного разделения ресурсов.

Код работает в 100 раз медленнее из-за ложного разделения ресурсов.

Libraries That Quietly Revolutionized C

Libraries That Quietly Revolutionized C

Томпсон рассказывает, как он разработал язык Go в Google.

Томпсон рассказывает, как он разработал язык Go в Google.

The World's Most Important Machine

The World's Most Important Machine

Почему Питер Шольце — математик, каких бывает раз в поколение?

Почему Питер Шольце — математик, каких бывает раз в поколение?

OpenAI, Google, Apple: кто реально победит в гонке AI

OpenAI, Google, Apple: кто реально победит в гонке AI

The Windows 11 Disaster That's Killing Microsoft

The Windows 11 Disaster That's Killing Microsoft

Кто пишет код лучше всех? Сравнил GPT‑5.2, Opus 4.5, Sonnet 4.5, Gemini 3, Qwen 3 Max, Kimi, GLM

Кто пишет код лучше всех? Сравнил GPT‑5.2, Opus 4.5, Sonnet 4.5, Gemini 3, Qwen 3 Max, Kimi, GLM

Terry Tao:

Terry Tao: "LLMs Are Simpler Than You Think – The Real Mystery Is Why They Work!"

Microsoft begs for mercy

Microsoft begs for mercy

The Original Sin of Computing...that no one can fix

The Original Sin of Computing...that no one can fix

One Formula That Demystifies 3D Graphics

One Formula That Demystifies 3D Graphics

Программирование с использованием математики | Лямбда-исчисление

Программирование с использованием математики | Лямбда-исчисление

The Future of Veritasium

The Future of Veritasium

Xah Ep732 Wolfram Language, Advent of Code 2025, Day 4, part 2. take 2

Xah Ep732 Wolfram Language, Advent of Code 2025, Day 4, part 2. take 2

Где начало СХЕМЫ? Понимаем, читаем, изучаем схемы. Понятное объяснение!

Где начало СХЕМЫ? Понимаем, читаем, изучаем схемы. Понятное объяснение!

© 2025 dtub. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: infodtube@gmail.com