The 8 Queen Problem in Computer Science - full Python code solutions смотреть онлайн
In the 8 queen problem you have a chess board and eight queens. You have to place all eight queens onto the board so that no two queens are attacking each other.
If you're not familiar with chess it's a game played on an eight by eight grid of squares (the same as draughts or chequers!). A queen is one of the chess pieces that can move in straight lines; horizontally, vertically or diagonally. A queen is attacking any other square that she can move to, so no two queens can be horizontally, vertically or diagonally aligned.
So we have to design a computer program that will find all the possible solutions to the problem.
Using brute force and just trying out every possible combination of placing the queens on the board results in having to test 4,426,165,368 combinations. If we can process 50,000 combinations per second that's going to take our computer over 24 hours to complete the task. We need a better solution!
We can start to work out ways of reducing this workload by examining the problem and optimising our algorithm.
In the video I'll walk you through designing the algorithm and then coding it. First we'll use a nested looping structure - placing for loops within for loops.
We'll then see how this lends itself to a solution using recursion. Don't run away at the mention of recursion! It's actually quite straight forward once you get the hang of it and drastically reduces the complexity of nested loop and tree structure based coding.
Make sure you visit the project page for this to download all the code used in the video.
https://bytesnbits.co.uk/the-8-queen-problem-computer-science
If you're interested in learning how to code in Python check out my beginners Python course at
https://www.udemy.com/course/learn-python-by-coding-games/?referralCode=F0D5CCA7D75F54975A8A
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «The 8 Queen Problem in Computer Science - full Python code solutions» бесплатно и без регистрации, вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.