Animated Python: 2D Lists and Connect Four
This video animates the execution of the Python functions which provide the core features of the game Connect Four. Viewers can see how the computer executes the code step by step and see the contents of the variables change as the computer executes the operations. The key components illustrated are two-dimensional lists, functions, conditionals, and variables.
Another way to visualize code running is https://pythontutor.com (which also has versions for C++, Java, and other programming languages).
Playlist of Visualizations:
- https://www.youtube.com/playlist?list=PLDs5gxU1J5CLKlTjZKLtPau7DFrAnDRHD
Animations made with Manim Community edition (https://www.manim.community/)
- https://github.com/kjlubick/manim_ace
Background music from YouTube Audio Library (https://youtube.com/audiolibrary)
- Siestita by Quincas Moreira
- The Trapezist by Quincas Moreira
- End of the Rainbow by Quincas Moreira
Sound effect from YouTube Audio Library
- Magic Chime
0:00 - Connect Four overview
0:26 - Defining the make_board and add_token functions
0:50 - Calling make_board to make a traditional 7 wide by 6 high board
1:41 - Multiplying a list by an integer?
2:40 - make_board for range loop finishes, completing the two-dimensional list
3:17 - Calling add_token to simulate players taking their turns
3:51 - Extracting an item from a two-dimensional list (in a condition)
5:41 - Updating an item in a two-dimensional list (at the bottom of the board)
7:59 - Putting one piece on top of an existing piece
9:25 - All pieces are in place, ready to look for winners horizontally
10:00 - Nested for loops to go through all rows and (most) columns
11:35 - winner_horizontal has found a non-empty piece
12:31 - short-circuit evaluation
13:33 - Four-in-a-row found!
14:20 - Why the minus 3 in the range stop parameter?
15:01 - winner_vertical code is similar to the winner_horizontal code
15:45 - winner_diagonal1 (down to the right) code combines horizontal and vertical
16:02 - winner_diagonal2 (down to the left) code requires some slight changes.
16:32 - What else is required to finish coding the game?
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Animated Python: 2D Lists and Connect Four», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.