Uploads from Xah Lee

Watch and track your favorite playlist.

Curated by: Xah Lee (847 videos)


Currently Playing: Xah Ep741 Wolfram Language, Advent of Code 2025, Day 7

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_show_ep741.html 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.


Tracks in this Playlist

✅ Progress Tracking

Automatically track which videos you have watched. Your completion status is updated at a glance, preventing you from re-watching episodes by mistake.

⏯️ Resume Playback

Never lose your spot. Our custom player remembers your exact video and timestamp, allowing you to dive right back in seamlessly.

📱 Cross-Device Sync

Sync your playlist states, watched progress, and premium preferences across your desktop, laptop, tablet, and mobile phone automatically.

Start Organizing Your YouTube Playlists

Simply paste any YouTube playlist URL or channel link in the application search bar to immediately generate a custom, sorted, and progress-tracked workspace. No registration required to start.

Explore Playlist Guides & How-Tos