title
Creating Simple Snake Game in C++ (With Source Code)@ProgrammingKnowledge
description
Welcome to this course on C++ Tutorial for Beginners. In this video we will see How to create C++ Snake Game. We will Practice programming in C++ by writing a simple game.
code: https://github.com/pknowledge/C-Snake-Game
C++ is general purpose, compiled, object-oriented programming language and its concepts served as the basis for several other languages such as Java, Python, Ruby, Perl etc.
The goal of this course is to provide you with a working knowledge of C++. We'll start with the basics, including syntax, operators, loops, and functions. This Course will explain you how to use data structures and create your own Functions. This Course will show you the details of the powerful object and template systems so you can create useful classes and objects.
#ProgrammingKnowledge #CppTutorial #CPPprogramming #Structures #Struct #SnakeGame #Game
★★★Top Online Courses From ProgrammingKnowledge ★★★
Python Programming Course ➡️ http://bit.ly/2vsuMaS ⚫️ http://bit.ly/2GOaeQB
Java Programming Course ➡️ http://bit.ly/2GEfQMf ⚫️ http://bit.ly/2Vvjy4a
Bash Shell Scripting Course ➡️ http://bit.ly/2DBVF0C ⚫️ http://bit.ly/2UM06vF
Linux Command Line Tutorials ➡️ http://bit.ly/2IXuil0 ⚫️ http://bit.ly/2IXukt8
C Programming Course ➡️ http://bit.ly/2GQCiD1 ⚫️ http://bit.ly/2ZGN6ej
C++ Programming Course ➡️ http://bit.ly/2V4oEVJ ⚫️ http://bit.ly/2XMvqMs
PHP Programming Course ➡️ http://bit.ly/2XP71WH ⚫️ http://bit.ly/2vs3od6
Android Development Course ➡️ http://bit.ly/2UHih5H ⚫️ http://bit.ly/2IMhVci
C# Programming Course ➡️ http://bit.ly/2Vr7HEl ⚫️ http://bit.ly/2W6RXTU
JavaFx Programming Course ➡️ http://bit.ly/2XMvZWA ⚫️ http://bit.ly/2V2CoAi
NodeJs Programming Course ➡️ http://bit.ly/2GPg7gA ⚫️ http://bit.ly/2GQYTQ2
Jenkins Course For Developers and DevOps ➡️ http://bit.ly/2Wd4l4W ⚫️ http://bit.ly/2J1B1ug
Scala Programming Tutorial Course ➡️ http://bit.ly/2PysyA4 ⚫️ http://bit.ly/2PCaVj2
Bootstrap Responsive Web Design Tutorial ➡️ http://bit.ly/2DFQ2yC ⚫️ http://bit.ly/2VoJWwH
MongoDB Tutorial Course ➡️ http://bit.ly/2LaCJfP ⚫️ http://bit.ly/2WaI7Ap
QT C++ GUI Tutorial For Beginners ➡️ http://bit.ly/2vwqHSZ
★★★ Online Courses to learn ★★★
Get 2 FREE Months of Unlimited Classes from skillshare - https://skillshare.eqcm.net/r1KEj
Data Science - http://bit.ly/2lD9h5L | http://bit.ly/2lI8wIl
Machine Learning - http://bit.ly/2WGGQpb | http://bit.ly/2GghLXX
Artificial Intelligence - http://bit.ly/2lYqaYx | http://bit.ly/2NmaPya
MERN Stack E-Degree Program - http://bit.ly/2kx2NFe | http://bit.ly/2lWj4no
DevOps E-degree - http://bit.ly/2k1PwUQ | http://bit.ly/2k8Ypfy
Data Analytics with R - http://bit.ly/2lBKqz8 | http://bit.ly/2lAjos3
AWS Certification Training - http://bit.ly/2kmLtTu | http://bit.ly/2lAkQL1
Projects in Java - http://bit.ly/2kzn25d | http://bit.ly/2lBMffs
Machine Learning With TensorFlow - http://bit.ly/2m1z3AF | http://bit.ly/2lBMhnA
Angular 8 - Complete Essential Guide - http://bit.ly/2lYvYRP
Kotlin Android Development Masterclass - http://bit.ly/2GcblsI
Learn iOS Programming Building Advance Projects - http://bit.ly/2kyX7ue
★★★ Follow ★★★
My Website - http://www.codebind.com
DISCLAIMER: This video and description contains affiliate links, which means that if you click on one of the product links, I’ll receive a small commission. This help support the channel and allows us to continue to make videos like this. Thank you for the support!
detail
{'title': 'Creating Simple Snake Game in C++ (With Source Code)@ProgrammingKnowledge', 'heatmap': [{'end': 1080.873, 'start': 1029.088, 'weight': 1}, {'end': 1286.534, 'start': 1231.87, 'weight': 0.769}, {'end': 1750.548, 'start': 1696.678, 'weight': 0.789}], 'summary': 'Tutorial series demonstrates creating a classic snake game in c++ with gameplay variations, covering snake class definition, game logic, collision handling, and random number generation flaws, while offering solutions for implementing and fixing game functionalities.', 'chapters': [{'end': 41.076, 'segs': [{'end': 41.076, 'src': 'embed', 'start': 0.049, 'weight': 0, 'content': [{'end': 5.355, 'text': 'In this video we will be making our second programming project which is going to be this, the snake game.', 'start': 0.049, 'duration': 5.306}, {'end': 7.878, 'text': "So I'm sure everybody knows how to play this game.", 'start': 5.715, 'duration': 2.163}, {'end': 13.844, 'text': 'You have a snake which grows on eating the food, and the objective is to grow the snake as long as possible,', 'start': 7.898, 'duration': 5.946}, {'end': 16.146, 'text': 'without hitting yourself or hitting one of the others.', 'start': 13.844, 'duration': 2.302}, {'end': 17.969, 'text': 'So if you do any of those, you lose this game.', 'start': 16.167, 'duration': 1.802}, {'end': 21.34, 'text': 'well, there are different variations of this scheme.', 'start': 19.278, 'duration': 2.062}, {'end': 27.185, 'text': 'some have teleportable walls, that is, if you go through this wall, you end up coming from there,', 'start': 21.34, 'duration': 5.845}, {'end': 31.989, 'text': 'and some versions even have obstacles in between them instead of this free space.', 'start': 27.185, 'duration': 4.804}, {'end': 33.79, 'text': "but we're not going to do any of those.", 'start': 31.989, 'duration': 1.801}, {'end': 41.076, 'text': 'we are just going to stick to the simple version with four concrete walls and empty space in between right.', 'start': 33.79, 'duration': 7.286}], 'summary': 'Creating a snake game with a simple version, featuring a growing snake and four walls.', 'duration': 41.027, 'max_score': 0.049, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o49.jpg'}], 'start': 0.049, 'title': 'Snake game programming project', 'summary': 'Covers the creation of the classic snake game with gameplay and variations, including teleportable walls and obstacles, ultimately following the simple version with four concrete walls and empty space.', 'chapters': [{'end': 41.076, 'start': 0.049, 'title': 'Snake game programming project', 'summary': 'Covers the creation of the classic snake game, focusing on its gameplay and variations, including teleportable walls and obstacles, while ultimately following the simple version with four concrete walls and empty space.', 'duration': 41.027, 'highlights': ['The objective is to grow the snake as long as possible without hitting yourself or hitting one of the others.', 'Different variations of the game include teleportable walls and obstacles.', 'The simple version features four concrete walls and empty space in between.']}], 'duration': 41.027, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o49.jpg', 'highlights': ['The objective is to grow the snake as long as possible without hitting yourself or hitting one of the others.', 'Different variations of the game include teleportable walls and obstacles.', 'The simple version features four concrete walls and empty space in between.']}, {'end': 1053.324, 'segs': [{'end': 163.286, 'src': 'embed', 'start': 118.87, 'weight': 0, 'content': [{'end': 120.732, 'text': 'and here we are going to draw the board.', 'start': 118.87, 'duration': 1.862}, {'end': 125.076, 'text': "so let's first define the dimensions of the board, the width and height.", 'start': 120.732, 'duration': 4.344}, {'end': 130.18, 'text': "so let's say the width is going to be somewhere around 50 characters.", 'start': 125.076, 'duration': 5.104}, {'end': 137.583, 'text': 'so since we are working on the console, you are going to see everything in terms of characters or this is basically a substitute for pixels,', 'start': 130.18, 'duration': 7.403}, {'end': 145.766, 'text': "if you are familiar with graphics and the height is going to be somewhere around, let's say, 25 characters.", 'start': 137.583, 'duration': 8.183}, {'end': 148.227, 'text': 'now these two things are constant, right.', 'start': 145.766, 'duration': 2.461}, {'end': 150.708, 'text': "so the these won't change throughout the project.", 'start': 148.227, 'duration': 2.481}, {'end': 154.99, 'text': 'so if you want to make them as constant, so you can just say const over here.', 'start': 150.708, 'duration': 4.282}, {'end': 158.882, 'text': 'so this keyword will make these things as constants.', 'start': 154.99, 'duration': 3.892}, {'end': 163.286, 'text': 'and now i would like to introduce you the concepts of macros.', 'start': 158.882, 'duration': 4.404}], 'summary': 'Defining a board with 50x25 character dimensions and introducing the concept of macros.', 'duration': 44.416, 'max_score': 118.87, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o118870.jpg'}, {'end': 415.213, 'src': 'embed', 'start': 342.166, 'weight': 2, 'content': [{'end': 352.106, 'text': 'so here we are just going to print out these hashes, Or else you need to print out the empty space, which is basically the space.', 'start': 342.166, 'duration': 9.94}, {'end': 358.471, 'text': 'So now if you call your board function that should print a board for us.', 'start': 353.127, 'duration': 5.344}, {'end': 360.693, 'text': 'So here we have the board.', 'start': 359.252, 'duration': 1.441}, {'end': 365.818, 'text': 'Now this board looks pretty squished to the left.', 'start': 362.515, 'duration': 3.303}, {'end': 369.341, 'text': 'So you can take care of that by adding a couple of tabs.', 'start': 365.978, 'duration': 3.363}, {'end': 372.924, 'text': 'And that will center the board.', 'start': 370.862, 'duration': 2.062}, {'end': 379.492, 'text': "so now let's see how to animate things on the console.", 'start': 374.949, 'duration': 4.543}, {'end': 384.654, 'text': 'so if you are familiar with graphics, or even if you have heard about animation,', 'start': 379.492, 'duration': 5.162}, {'end': 389.837, 'text': 'you might know that animation is nothing but just fast moving pictures, right.', 'start': 384.654, 'duration': 5.183}, {'end': 395.621, 'text': "so here, if you want to animate something on the board, let's say you have some object on the board.", 'start': 389.837, 'duration': 5.784}, {'end': 401.364, 'text': 'then the way you animate is you will quickly move the position of that object and it will appear as moving.', 'start': 395.621, 'duration': 5.743}, {'end': 408.969, 'text': 'so to move something on the board or to place something on the board, you need to know about the coordinate system which the computer uses.', 'start': 401.704, 'duration': 7.265}, {'end': 411.11, 'text': "so let's talk about that quickly.", 'start': 408.969, 'duration': 2.141}, {'end': 415.213, 'text': 'so you might have come across this cartesian coordinate system in your math class, right.', 'start': 411.11, 'duration': 4.103}], 'summary': 'Printing hashes and spaces, centering the board, animating objects using the coordinate system.', 'duration': 73.047, 'max_score': 342.166, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o342166.jpg'}, {'end': 519.212, 'src': 'embed', 'start': 494.84, 'weight': 4, 'content': [{'end': 501.445, 'text': 'you can use this coordinate system to move objects in your screen or even place objects in your screen.', 'start': 494.84, 'duration': 6.605}, {'end': 505.108, 'text': 'so every object is defined by x coordinate and y coordinate.', 'start': 501.445, 'duration': 3.663}, {'end': 507.73, 'text': 'so if you put some point here,', 'start': 505.108, 'duration': 2.622}, {'end': 519.212, 'text': 'so it has some x coordinate that is how much it has moved from the origin in the horizontal direction and some y coordinate that is how much it has moved from the vertical direction,', 'start': 507.73, 'duration': 11.482}], 'summary': 'Coordinate system allows moving or placing objects on screen using x and y coordinates.', 'duration': 24.372, 'max_score': 494.84, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o494840.jpg'}, {'end': 988.161, 'src': 'embed', 'start': 939.64, 'weight': 6, 'content': [{'end': 945.001, 'text': "which will basically allow you to control the cursor's position on your console.", 'start': 939.64, 'duration': 5.361}, {'end': 957.797, 'text': 'and here what you need to do is, instead of system clear, you can do set console cursor position, and here you need to give some handle,', 'start': 945.001, 'duration': 12.796}, {'end': 964.784, 'text': 'which is get std handle instead of std output handle.', 'start': 957.797, 'duration': 6.987}, {'end': 967.607, 'text': "so if you don't understand what this means, it's okay.", 'start': 964.784, 'duration': 2.823}, {'end': 970.106, 'text': "it's just you can think of it,", 'start': 968.385, 'duration': 1.721}, {'end': 978.473, 'text': "as it's going to pick up the cursor from the end and it's going to put it back on the origin and to put it back on the origin or any specific coordinate,", 'start': 970.106, 'duration': 8.367}, {'end': 982.576, 'text': 'you need to pass in a coordinate data structure.', 'start': 978.473, 'duration': 4.103}, {'end': 988.161, 'text': "well, coordinate is basically a simple data structure which is already defined in windows.h and we'll be using this.", 'start': 982.576, 'duration': 5.585}], 'summary': 'Control cursor position on console using set console cursor position and get std handle, with coordinate data structure.', 'duration': 48.521, 'max_score': 939.64, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o939640.jpg'}, {'end': 1065.601, 'src': 'embed', 'start': 1032.451, 'weight': 7, 'content': [{'end': 1036.792, 'text': 'so, as you can see, there is no flickering, although you can see that cursor updates somewhere.', 'start': 1032.451, 'duration': 4.341}, {'end': 1040.496, 'text': 'but this is much better, right instead of the flickering screen.', 'start': 1036.792, 'duration': 3.704}, {'end': 1043.578, 'text': 'so again, this solution is only for windows user.', 'start': 1040.496, 'duration': 3.082}, {'end': 1050.543, 'text': "so if you're in linux, you have some other libraries, like you have n cursors and many other libraries.", 'start': 1043.578, 'duration': 6.965}, {'end': 1053.324, 'text': 'a simple google search will get you what you want.', 'start': 1050.543, 'duration': 2.781}, {'end': 1057.634, 'text': 'right now, let us remove all these things.', 'start': 1053.324, 'duration': 4.31}, {'end': 1065.601, 'text': 'we have now understood how to do animation, and here what we are going to do is we are first going to define our snake.', 'start': 1057.634, 'duration': 7.967}], 'summary': 'Demonstrates a flicker-free animation solution for windows users with a focus on defining a snake for animation.', 'duration': 33.15, 'max_score': 1032.451, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o1032451.jpg'}], 'start': 41.076, 'title': 'Snake game development in c++', 'summary': 'Covers creating a snake game in c++ with a 50x25 character board, introducing macros, addressing challenges and solutions in animating objects on the console, and controlling console cursor position for neat animation, particularly for windows users.', 'chapters': [{'end': 372.924, 'start': 41.076, 'title': 'Snake game board setup & macros', 'summary': 'Covers the creation of a console application for a snake game in c++, defining the game board with dimensions of 50x25 characters, and introducing the use of macros for defining constants and operations.', 'duration': 331.848, 'highlights': ['Defining the game board with dimensions of 50x25 characters The board is defined with a width of 50 characters and a height of 25 characters, which are constant throughout the project.', 'Introduction to the use of macros for defining constants and operations The concept of macros is introduced as one-liner codes used to define symbols for specific operations, such as defining the width and height of the board.', 'Explanation of printing the board using loops and characters The process of printing the board is explained using nested loops to control the rows and width, with specific characters for walls and spaces based on row numbers.']}, {'end': 826.312, 'start': 374.949, 'title': 'Animating objects on console', 'summary': 'Discusses animating objects on the console using a cartesian coordinate system, demonstrating how to move and place objects on the board, and addressing the challenges and solutions in animating objects on the console.', 'duration': 451.363, 'highlights': ['Explaining the Cartesian coordinate system and its application in computer graphics The transcript explains the Cartesian coordinate system used in computer graphics, where the origin is shifted to the top left corner, x increases to the right, and y increases downwards.', 'Demonstrating the use of coordinate system to move and place objects on the screen The transcript illustrates how the coordinate system is utilized to define the position of objects on the screen, with x and y coordinates determining the horizontal and vertical positions respectively.', 'Addressing challenges in animating objects on the console and providing a solution The challenges of flickering and the inability to control the refresh rate in console animation are highlighted, with the suggestion of overwriting the board instead of clearing the screen to mitigate flickering.']}, {'end': 1053.324, 'start': 826.312, 'title': 'Control console cursor position', 'summary': 'Explains how to control the console cursor position for a neat animation, particularly for windows users, using the windows.s library and the set console cursor position function, to avoid flickering screens and achieve a clean animation.', 'duration': 227.012, 'highlights': ['Explanation of using the windows.s library and set console cursor position function for controlling the console cursor position for a neat animation. Neat animation, use of windows.s library, set console cursor position function', 'Clarification that the provided solution is specifically for Windows users and mentions that Linux users need to find alternative libraries such as n cursors. Solution specific to Windows, mention of alternative libraries for Linux users', 'Description of the coordinate data structure and its usage in controlling the cursor position. Usage of coordinate data structure, explanation of its role in controlling cursor position']}], 'duration': 1012.248, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o41076.jpg', 'highlights': ['Defining the game board with dimensions of 50x25 characters', 'Introduction to the use of macros for defining constants and operations', 'Explanation of printing the board using loops and characters', 'Explaining the Cartesian coordinate system and its application in computer graphics', 'Demonstrating the use of coordinate system to move and place objects on the screen', 'Addressing challenges in animating objects on the console and providing a solution', 'Explanation of using the windows.s library and set console cursor position function for controlling the console cursor position for a neat animation', 'Clarification that the provided solution is specifically for Windows users and mentions that Linux users need to find alternative libraries such as n cursors', 'Description of the coordinate data structure and its usage in controlling the cursor position']}, {'end': 2003.433, 'segs': [{'end': 1149.977, 'src': 'embed', 'start': 1123.418, 'weight': 0, 'content': [{'end': 1131.07, 'text': 'and you also need a direction, And you also need a velocity, or you can say speed of the snake.', 'start': 1123.418, 'duration': 7.652}, {'end': 1132.27, 'text': 'So how fast it moves.', 'start': 1131.09, 'duration': 1.18}, {'end': 1138.953, 'text': 'So here in case of velocity or speed we are going to talk in terms of number of characters.', 'start': 1132.53, 'duration': 6.423}, {'end': 1140.313, 'text': 'So let me write it down here.', 'start': 1139.033, 'duration': 1.28}, {'end': 1144.975, 'text': 'That is basically it is going to move 2 characters at a time, 3 characters at a time and so on.', 'start': 1140.673, 'duration': 4.302}, {'end': 1149.977, 'text': 'So in case you are working with some graphics library that is the same thing you do with pixels.', 'start': 1145.255, 'duration': 4.722}], 'summary': "Snake's speed is measured in characters, moving 2 or 3 at a time.", 'duration': 26.559, 'max_score': 1123.418, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o1123418.jpg'}, {'end': 1191.893, 'src': 'embed', 'start': 1168.359, 'weight': 1, 'content': [{'end': 1175.982, 'text': 'so again, if you are in linux, you need to define the structure and for using this quad, you need to include a windows.h.', 'start': 1168.359, 'duration': 7.623}, {'end': 1178.664, 'text': 'right, so this is because this is a separate file.', 'start': 1175.982, 'duration': 2.682}, {'end': 1184.547, 'text': "let's, snake.h is a separate file, so even if you are included in main, you need to include it again.", 'start': 1178.664, 'duration': 5.883}, {'end': 1191.893, 'text': "but you can exclude this over here, because once we actually include this file, you're going to include all these things.", 'start': 1184.547, 'duration': 7.346}], 'summary': 'In linux, structure needs to be defined, and for using a quad, a windows.h needs to be included.', 'duration': 23.534, 'max_score': 1168.359, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o1168359.jpg'}, {'end': 1286.534, 'src': 'heatmap', 'start': 1231.87, 'weight': 0.769, 'content': [{'end': 1240.813, 'text': "so let's say char direction, and in the public section we need to define constructor first, and this is going to take a position that is,", 'start': 1231.87, 'duration': 8.943}, {'end': 1245.154, 'text': 'the initial position and initial velocity for our snake.', 'start': 1240.813, 'duration': 4.341}, {'end': 1252.437, 'text': "so let's define this constructor and snake.cpp, and here we need to again specify those things.", 'start': 1245.154, 'duration': 7.283}, {'end': 1258.956, 'text': "so code position and int velocity, and here you don't have to include windows.h.", 'start': 1252.437, 'duration': 6.519}, {'end': 1265.978, 'text': "that is because again you are including snake.h, which comes with windows.h, so you don't have to include it again.", 'start': 1258.956, 'duration': 7.022}, {'end': 1270.039, 'text': 'and here you need to set the position and velocity.', 'start': 1265.978, 'duration': 4.061}, {'end': 1276.241, 'text': 'so since I am using the same name for both the variables, I need to use this pointer.', 'start': 1270.039, 'duration': 6.202}, {'end': 1280.422, 'text': "so if you are not using the same name, it's ok, but if you are using the same name,", 'start': 1276.241, 'duration': 4.181}, {'end': 1286.534, 'text': 'you need to use this pointer and the velocity also goes in the same way.', 'start': 1280.422, 'duration': 6.112}], 'summary': 'Defining a constructor in snake.cpp to set initial position and velocity for the snake.', 'duration': 54.664, 'max_score': 1231.87, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o1231870.jpg'}, {'end': 1750.548, 'src': 'heatmap', 'start': 1696.678, 'weight': 0.789, 'content': [{'end': 1708.746, 'text': 'you need to move the snake upwards, right, so snake.changedir up, sorry u, and then break, and you need to do this for all the four directions.', 'start': 1696.678, 'duration': 12.068}, {'end': 1722.51, 'text': 'so control c, v, v, v, w, a s, d and d is basically go to right, s is down and this is left for now.', 'start': 1708.746, 'duration': 13.764}, {'end': 1724.951, 'text': 'this will move our snake in our preferred direction.', 'start': 1722.51, 'duration': 2.441}, {'end': 1729.992, 'text': 'and to move the snake, you just call snake.move snake, which will move our snake.', 'start': 1724.951, 'duration': 5.041}, {'end': 1735.634, 'text': 'and now, if you run this, you will be getting a snake which can move on your command.', 'start': 1729.992, 'duration': 5.642}, {'end': 1742.166, 'text': 'So now you can see that it is not moving, because initially we had set this next direction to be N, right?', 'start': 1736.104, 'duration': 6.062}, {'end': 1747.987, 'text': 'So we did not have any case which will move the position for N.', 'start': 1742.186, 'duration': 5.801}, {'end': 1750.548, 'text': "So it doesn't move for any iteration.", 'start': 1747.987, 'duration': 2.561}], 'summary': 'The snake needs to be moved in all four directions using the specified controls to enable movement.', 'duration': 53.87, 'max_score': 1696.678, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o1696678.jpg'}, {'end': 1778.099, 'src': 'embed', 'start': 1750.928, 'weight': 2, 'content': [{'text': 'And now once I press W, you can see that it started moving up.', 'start': 1750.928, 'duration': 2.881}, {'text': 'A, it started moving left.', 'start': 1754.329, 'duration': 1.261}, {'text': 'S, it started moving down.', 'start': 1756.23, 'duration': 1.42}, {'text': 'And D, it started moving to the right.', 'start': 1757.95, 'duration': 2.121}, {'text': 'so now I can control this little character and keeps moving.', 'start': 1760.506, 'duration': 4.183}, {'text': 'that is how the snake game is defined.', 'start': 1764.689, 'duration': 1.861}, {'text': 'so once you press a key, it will keep moving in that particular direction until you change the direction.', 'start': 1766.55, 'duration': 5.144}, {'text': 'so this is what we needed and we got a moving character on our board.', 'start': 1771.694, 'duration': 6.405}], 'summary': 'Character moves in response to keyboard input, and snake game is defined.', 'duration': 27.171, 'max_score': 1750.928, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o1750928.jpg'}], 'start': 1053.324, 'title': 'Creating snake class and game in c++', 'summary': "Involves defining a snake class with private variables like position, length, direction, and velocity to control the movement, with a focus on the number of characters moved at a time. it also explains how to create and use a snake class in c++, including defining the structure, using windows.h, creating a constructor, and methods for changing direction, moving the snake, and getting its position, along with capturing keystrokes to control the snake's movement. additionally, it illustrates the development of a snake game, covering the movement controls, food generation, and initial position setting, emphasizing the use of random number generation and the 'windows.h' library, to create an interactive game board.", 'chapters': [{'end': 1168.359, 'start': 1053.324, 'title': 'Defining snake class for animation', 'summary': 'Involves defining a snake class with private variables like position, length, direction, and velocity to control the movement, with a focus on the number of characters moved at a time.', 'duration': 115.035, 'highlights': ['The snake class is being defined with private variables like position, length, direction, and velocity to control the movement, with a focus on the number of characters moved at a time.', "The snake's position, length, direction, and velocity are the key features being defined for its movement.", 'The velocity or speed of the snake is quantified in terms of the number of characters moved at a time, analogous to working with pixels in a graphics library.']}, {'end': 1693.735, 'start': 1168.359, 'title': 'Creating and using snake class in c++', 'summary': "Explains how to create and use a snake class in c++, including defining the structure, using windows.h, creating a constructor, and methods for changing direction, moving the snake, and getting its position, along with capturing keystrokes to control the snake's movement.", 'duration': 525.376, 'highlights': ['Defining the structure and including windows.h for using the Snake class in C++ The chapter emphasizes the need to define the structure and include windows.h for using the Snake class in C++, due to it being a separate file, and explains the purpose of the guard block to avoid multiple initializations.', "Creating a constructor and methods for changing direction, moving the snake, and getting its position The transcript details the creation of a constructor for initializing the snake's position and velocity, methods for changing the snake's direction and moving it in a particular direction, and also a method for getting the snake's position.", "Capturing keystrokes to control the snake's movement using conio library The chapter explains the use of the conio library to capture keystrokes for controlling the snake's movement by checking if a key is hit and capturing the key using getchx, and then using a switch statement to control the snake's movement based on the captured key."]}, {'end': 2003.433, 'start': 1693.735, 'title': 'Snake game development', 'summary': "Illustrates the development of a snake game, covering the movement controls, food generation, and initial position setting, emphasizing the use of random number generation and the 'windows.h' library, to create an interactive game board.", 'duration': 309.698, 'highlights': ["The chapter explains how to control the snake's movement in four directions, using 'w' for upwards, 'a' for left, 's' for downwards, and 'd' for right, resulting in a snake that moves in the preferred direction. The snake's movement is controlled in four directions using 'w' for upwards, 'a' for left, 's' for downwards, and 'd' for right, providing directional control for the snake.", "The process of generating food for the game is demonstrated, incorporating the use of the 'windows.h' library for position allocation and random number generation to define the initial starting position of the food on the game board. The generation of food for the game is depicted, utilizing the 'windows.h' library for position allocation and implementing random number generation to define the initial starting position of the food on the game board.", "The explanation of initializing the food position using random values and the generation of random numbers within a specific range is provided, showcasing the utilization of 'cstdlib' for the random function and the 'rand mod' formula for number generation. The process of initializing the food position with random values and generating random numbers within a specific range is outlined, using 'cstdlib' for the random function and the 'rand mod' formula for number generation."]}], 'duration': 950.109, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o1053324.jpg', 'highlights': ['The snake class is being defined with private variables like position, length, direction, and velocity to control the movement, with a focus on the number of characters moved at a time.', 'Defining the structure and including windows.h for using the Snake class in C++ The chapter emphasizes the need to define the structure and include windows.h for using the Snake class in C++, due to it being a separate file, and explains the purpose of the guard block to avoid multiple initializations.', "The chapter explains how to control the snake's movement in four directions, using 'w' for upwards, 'a' for left, 's' for downwards, and 'd' for right, resulting in a snake that moves in the preferred direction."]}, {'end': 2467.769, 'segs': [{'end': 2037.582, 'src': 'embed', 'start': 2003.433, 'weight': 0, 'content': [{'text': 'the upper limit is going to be height and the lower limit is again going to be 1.', 'start': 2003.433, 'duration': 4.882}, {'text': 'so this will generate a random position for our food which will be on the board.', 'start': 2008.315, 'duration': 7.083}, {'text': "and for getting position it's very simple.", 'start': 2016.227, 'duration': 2.762}, {'text': 'you just need to say quad get position.', 'start': 2018.989, 'duration': 7.125}, {'text': 'so we did not define that.', 'start': 2026.114, 'duration': 2.222}, {'text': 'well, we did quad get position and here you need to say return pos.', 'start': 2028.336, 'duration': 5.163}, {'text': 'so this will return the position of the current food.', 'start': 2033.499, 'duration': 4.083}], 'summary': 'Generate random food position within defined limits.', 'duration': 34.149, 'max_score': 2003.433, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o2003433.jpg'}, {'end': 2101.3, 'src': 'embed', 'start': 2067.101, 'weight': 3, 'content': [{'text': "so it's going to be food and as a constructor it doesn't need anything.", 'start': 2067.101, 'duration': 4.824}, {'text': 'so you can just put it like this and here we need to check whether the snake has eaten the food or not.', 'start': 2071.925, 'duration': 8.689}, {'text': 'so for that what you can do is you can have a function inside the snake which will check whether its coordinates have matched the coordinates of food or not.', 'start': 2080.614, 'duration': 10.223}, {'text': "so what you can do is you can, inside the snake.h, you can define another function called boolean, let's say eaten.", 'start': 2090.837, 'duration': 10.463}], 'summary': 'Snake game: implement function to check if snake has eaten food.', 'duration': 34.199, 'max_score': 2067.101, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o2067101.jpg'}, {'end': 2234.611, 'src': 'embed', 'start': 2202.611, 'weight': 5, 'content': [{'text': 'so you can say void grow, and we define it as void snake grow, which is length++, and this should grow our snake and that should be it.', 'start': 2202.611, 'duration': 19.409}, {'text': 'so now you have the logic for eating a food and then growing the snake.', 'start': 2222.02, 'duration': 4.804}, {'text': 'well, we are not going to see the snake grow, but it is just going to grow in numbers.', 'start': 2226.824, 'duration': 5.425}, {'text': "we won't be seeing that visually.", 'start': 2232.249, 'duration': 2.362}], 'summary': 'Code logic implemented for snake growth when eating food.', 'duration': 32, 'max_score': 2202.611, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o2202611.jpg'}, {'end': 2385.853, 'src': 'embed', 'start': 2335.401, 'weight': 1, 'content': [{'text': "well, it's going to be in the same places.", 'start': 2335.401, 'duration': 2.042}, {'text': 'that is because we did not seed the random function.', 'start': 2337.443, 'duration': 3.122}, {'text': 'so if you have seen the previous video where we made the tic tac toe game, you know what is seed is well, to seed the random function.', 'start': 2340.565, 'duration': 8.626}, {'text': 'what we are going to do here is we are just going to say in the main function, so to seed the random function, what we are going to do is hash,', 'start': 2349.191, 'duration': 7.925}, {'text': 'include seed time and here in the main function we will say s and time null, right.', 'start': 2357.116, 'duration': 10.525}, {'text': 'so now, when you run it, you will have a snake and food, and this food will be generated once you eat it.', 'start': 2367.641, 'duration': 7.665}, {'text': 'so here i ate that food.', 'start': 2375.306, 'duration': 1.561}, {'text': 'now you can see that another one has been generated and then another one has been generated.', 'start': 2376.867, 'duration': 4.363}, {'text': 'so we did not write the collision logic.', 'start': 2381.23, 'duration': 2.481}, {'text': 'so if you go through the wall, you will come.', 'start': 2383.711, 'duration': 2.142}], 'summary': 'Adding seed to random function for generating snake and food in the main function.', 'duration': 50.452, 'max_score': 2335.401, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o2335401.jpg'}], 'start': 2003.433, 'title': 'Snake game logic and collision', 'summary': 'Explains the implementation of logic for generating and eating food in the snake game, including creating random food, checking if the snake has eaten it, and growing the snake. additionally, it covers adding collision logic and implementing a function to check for collisions with the walls.', 'chapters': [{'end': 2305.261, 'start': 2003.433, 'title': 'Snake game logic implementation', 'summary': 'Explains the implementation of the logic for generating and eating food in the snake game, including the creation of a random position for food, checking if the snake has eaten the food, and growing the snake when the food is eaten.', 'duration': 301.828, 'highlights': ['The chapter explains the logic for generating a random position for food on the board and retrieving the current food position using quad get position.', "It details the process of checking whether the snake has eaten the food by comparing the coordinates of the snake's head with the coordinates of the food, returning true if the coordinates match and false if they don't.", 'It outlines the function to grow the snake by increasing its length when the food is eaten, and the necessity to include the logic for drawing the food visually in the game.']}, {'end': 2467.769, 'start': 2305.261, 'title': 'Adding collision logic and random food generation', 'summary': 'Covers adding collision logic to the snake game, explaining the use of seeding for random food generation, and the implementation of a function to check for collisions with the walls.', 'duration': 162.508, 'highlights': ['The chapter explains the need for collision logic in the snake game, highlighting the conditions for collision with the walls and the function to return true or false based on the collision position, providing a clear understanding of the game mechanics.', 'It emphasizes the importance of seeding the random function to ensure the generation of food in different positions, referencing the previous video on the tic-tac-toe game for understanding the concept of seeding, adding depth to the explanation of random food generation.', 'The transcript details the process of generating random food in the snake game, demonstrating the immediate generation of new food after consuming the existing one, indicating the dynamic nature of the game with quantifiable information about food generation.']}], 'duration': 464.336, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o2003433.jpg', 'highlights': ['The chapter explains the logic for generating a random position for food on the board and retrieving the current food position using quad get position.', 'It emphasizes the importance of seeding the random function to ensure the generation of food in different positions, referencing the previous video on the tic-tac-toe game for understanding the concept of seeding, adding depth to the explanation of random food generation.', 'The chapter explains the need for collision logic in the snake game, highlighting the conditions for collision with the walls and the function to return true or false based on the collision position, providing a clear understanding of the game mechanics.', "It details the process of checking whether the snake has eaten the food by comparing the coordinates of the snake's head with the coordinates of the food, returning true if the coordinates match and false if they don't.", 'The transcript details the process of generating random food in the snake game, demonstrating the immediate generation of new food after consuming the existing one, indicating the dynamic nature of the game with quantifiable information about food generation.', 'It outlines the function to grow the snake by increasing its length when the food is eaten, and the necessity to include the logic for drawing the food visually in the game.']}, {'end': 2900.909, 'segs': [{'end': 2498.813, 'src': 'embed', 'start': 2467.769, 'weight': 1, 'content': [{'text': 'which will track whether the game is over or not.', 'start': 2467.769, 'duration': 2.422}, {'text': 'so in the beginning, game over is false and while true you will change it to while game over or while not game over.', 'start': 2470.191, 'duration': 9.656}, {'text': 'you need to run all these things and if the snake collided.', 'start': 2479.847, 'duration': 4.342}, {'text': 'so if the snake collided, then you will just say game over equal to true and this will stop executing the loop right now.', 'start': 2484.189, 'duration': 12.123}, {'text': 'if you run this, we got an error.', 'start': 2496.312, 'duration': 2.501}], 'summary': "The program tracks game status, setting 'game over' to true if the snake collides, resulting in an error.", 'duration': 31.044, 'max_score': 2467.769, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o2467769.jpg'}, {'end': 2573.382, 'src': 'embed', 'start': 2530.34, 'weight': 0, 'content': [{'text': 'so i think that the video has become long enough.', 'start': 2530.34, 'duration': 3.001}, {'text': 'it has been an hour.', 'start': 2533.341, 'duration': 1.44}, {'text': "so the next video we'll see how to increase the snake's length and show it visually.", 'start': 2534.781, 'duration': 5.442}, {'text': "well, we are including the snake's length over here, but we are not showing the increase in its body right.", 'start': 2540.223, 'duration': 6.262}, {'text': 'so we are just moving the head and we are eating the, and we made quite a progress, right.', 'start': 2546.485, 'duration': 4.201}, {'text': "so let's see what we have made.", 'start': 2550.686, 'duration': 1.441}, {'text': 'we have made this board and then we have updated the board without causing any flickering,', 'start': 2552.127, 'duration': 6.347}, {'text': "and that's a great improvement and we have also animated this character which can eat the food,", 'start': 2558.474, 'duration': 5.603}, {'text': 'and we have also written the logic for the food to appear at different random locations right in this video.', 'start': 2564.077, 'duration': 5.563}, {'text': 'we will complete this game by adding the body for the snake.', 'start': 2569.64, 'duration': 3.742}], 'summary': 'In the hour-long video, progress has been made on the snake game including board updates, character animation, and food logic implementation.', 'duration': 43.042, 'max_score': 2530.34, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o2530340.jpg'}, {'end': 2786.416, 'src': 'embed', 'start': 2754.795, 'weight': 3, 'content': [{'text': 'From the next time onwards, when the food is eaten, the logic is over here, right? Which is after the seeding function.', 'start': 2754.795, 'duration': 6.184}, {'text': 'That is why you are getting randomized locations for the constituent foods but not for the first time.', 'start': 2761.499, 'duration': 4.599}, {'text': 'So to fix that, it is very simple.', 'start': 2766.578, 'duration': 1.802}, {'text': 'What you can do is you can get rid of the constructor.', 'start': 2768.4, 'duration': 2.822}, {'text': "I don't know why I defined this constructor.", 'start': 2771.603, 'duration': 1.921}, {'text': 'Basically, when we define a constructor,', 'start': 2774.045, 'duration': 2.182}, {'text': "what we actually see is we need the constructor to do something which the default constructor which the compiler will construct for this class can't do.", 'start': 2776.227, 'duration': 10.189}], 'summary': 'The logic for obtaining randomized food locations after the seeding function is discussed, with a suggestion to remove the unnecessary constructor.', 'duration': 31.621, 'max_score': 2754.795, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o2754795.jpg'}, {'end': 2905.75, 'src': 'embed', 'start': 2879.564, 'weight': 5, 'content': [{'text': 'That is a major logical issue with this program which we made in the previous video and we will be fixing that right now.', 'start': 2879.564, 'duration': 7.322}, {'text': 'So here if you see there is no food on the board but actually it has been generated.', 'start': 2887.186, 'duration': 3.261}, {'text': 'We will see why in a few minutes.', 'start': 2890.487, 'duration': 0.88}, {'text': 'Okay So close that and now we fix the most obvious issue.', 'start': 2892.147, 'duration': 4.061}, {'text': "Now let's go on to the issue which we just saw that the food is not getting generated.", 'start': 2896.308, 'duration': 4.601}, {'text': 'what we are doing in the generate foot method.', 'start': 2902.728, 'duration': 3.022}], 'summary': 'Fixing logical issue in program related to food generation.', 'duration': 26.186, 'max_score': 2879.564, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o2879564.jpg'}], 'start': 2467.769, 'title': 'Developing a snake game and fixing logical error in food generation', 'summary': 'Covers the development of a snake game, including handling game over status and collisions, and increasing snake length visually. it also discusses fixing the logical error in food generation by ensuring the initial food location is randomized.', 'chapters': [{'end': 2596.921, 'start': 2467.769, 'title': 'Developing a snake game', 'summary': 'Covers the development of a snake game, including tracking game over status, handling collisions, and updating game features, with a plan to increase snake length visually.', 'duration': 129.152, 'highlights': ['The video discusses tracking the game over status, handling collisions, and updating game features, with a plan to increase snake length visually.', 'The code is modified to track game over status and handle collisions, ensuring the game ends successfully when the snake hits a wall.', 'The progress includes creating a board, updating it without flickering, animating the snake to eat food, and coding the logic for food to appear at random locations.']}, {'end': 2900.909, 'start': 2596.981, 'title': 'Fixing logical error in food generation', 'summary': 'Discusses the logical error in food generation where the initial food location is not randomized, and suggests fixing it by removing the constructor and manually calling the generatefood method to ensure the first food is generated at a random location.', 'duration': 303.928, 'highlights': ['Removing the constructor and manually calling the generateFood method ensures the first food is generated at a random location, solving the logical error in food generation.', 'The issue arises from calling the random function before seeding it, resulting in the first food location not being randomized, which can be resolved by removing the constructor and calling the generateFood method.', 'The logical issue with the program is that at some point, no food is visible on the board despite being generated, indicating a major issue that needs fixing.']}], 'duration': 433.14, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o2467769.jpg', 'highlights': ['The video discusses tracking the game over status, handling collisions, and updating game features, with a plan to increase snake length visually.', 'The code is modified to track game over status and handle collisions, ensuring the game ends successfully when the snake hits a wall.', 'The progress includes creating a board, updating it without flickering, animating the snake to eat food, and coding the logic for food to appear at random locations.', 'Removing the constructor and manually calling the generateFood method ensures the first food is generated at a random location, solving the logical error in food generation.', 'The issue arises from calling the random function before seeding it, resulting in the first food location not being randomized, which can be resolved by removing the constructor and calling the generateFood method.', 'The logical issue with the program is that at some point, no food is visible on the board despite being generated, indicating a major issue that needs fixing.']}, {'end': 3491.906, 'segs': [{'end': 2999.485, 'src': 'embed', 'start': 2973.194, 'weight': 2, 'content': [{'text': 'And what we are saying is, we are saying that this 0 and this 24 is not required in our range.', 'start': 2973.194, 'duration': 7.185}, {'text': 'So basically we want numbers from 1 to 23.', 'start': 2980.66, 'duration': 3.498}, {'text': "We don't want 0.", 'start': 2984.158, 'duration': 1.221}, {'text': "We don't want the last character which is 24.", 'start': 2985.379, 'duration': 1.8}, {'text': 'So this range becomes 1 to 23.', 'start': 2987.179, 'duration': 4.062}, {'text': 'Well to get a number in this range what you can do is plug it into the formula.', 'start': 2991.241, 'duration': 5.223}, {'text': 'So what is a formula for random number generation?', 'start': 2996.504, 'duration': 2.981}], 'summary': 'Desired range: 1 to 23, excluding 0 and 24.', 'duration': 26.291, 'max_score': 2973.194, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o2973194.jpg'}, {'end': 3414.411, 'src': 'embed', 'start': 3367.389, 'weight': 0, 'content': [{'text': 'When width equal to 48, j equal to 47 as we just saw and when this 49, it is not present at all.', 'start': 3367.389, 'duration': 8.202}, {'text': 'So, this is the reason why we were not getting anything on the book.', 'start': 3376.611, 'duration': 4.321}, {'text': 'This is not the complete reason, the actual reason was because we were Messing up the formula and the random number generation.', 'start': 3381.312, 'duration': 7.032}, {'text': "I feel this is one of the major reasons why we won't be getting even after fixing the random number generation.", 'start': 3388.704, 'duration': 7.902}, {'text': "That is because if you create any food at the extreme positions, that won't be visible to you at all.", 'start': 3396.666, 'duration': 5.942}, {'text': 'So to fix this, what we can do is by comparing the coordinates, we need to add 1 to this.', 'start': 3402.868, 'duration': 4.441}, {'text': "So if 0, we don't care about the 0 or the 49th coordinate.", 'start': 3408.329, 'duration': 4.722}, {'text': "We don't want these two things.", 'start': 3413.091, 'duration': 1.32}], 'summary': 'Issue found when width = 48, j = 47; fixing by comparing coordinates and adding 1.', 'duration': 47.022, 'max_score': 3367.389, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o3367389.jpg'}], 'start': 2902.728, 'title': 'Random number generation flaws', 'summary': 'Discusses generating random numbers with exclusion of first and last characters, highlighting discrepancies in initial reasoning and mathematical implications. it also addresses flaws in the logic of random number generation and looping, emphasizing the need for correction to ensure visibility and functionality of elements within the specified range.', 'chapters': [{'end': 2947.278, 'start': 2902.728, 'title': 'Generating random numbers for character placement', 'summary': 'Discusses generating random numbers within a range for character placement, emphasizing the exclusion of the first and last characters, and highlights the discrepancies between the initial reasoning and the actual mathematical implications of the approach.', 'duration': 44.55, 'highlights': ['The need for random numbers in the range of 1 to width minus 1 is explained due to the reservation of the first and last characters, thus excluding them from the range of selection.', 'The discrepancy between the initial reasoning for selecting random numbers and the actual mathematical implications of the approach is highlighted, prompting a reevaluation of the strategy.']}, {'end': 3491.906, 'start': 2947.338, 'title': 'Random number generation and looping flaws', 'summary': 'Discusses the flaws in the logic of random number generation and looping, where the random number generation formula and the inner loop logic need correction to ensure the visibility and functionality of elements within the specified range.', 'duration': 544.568, 'highlights': ['Explains the reasoning behind the range 1 to 23 for random number generation and the correct formula for generating numbers within a specified range. Range 1 to 23, formula for random number generation', 'Highlights the flaw in the inner loop logic for width and the impact on displaying coordinates, emphasizing the need to correct the loop to ensure the visibility of elements within the specified range. Mismatch between loop range and actual coordinate, need for correction to ensure visibility', 'Addresses the need to add 1 to the coordinate comparison to ensure elements are visible within the specified range, and demonstrates the correction to fix logical errors and ensure the proper functionality of the program. Correction to ensure visibility of elements within the specified range']}], 'duration': 589.178, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o2902728.jpg', 'highlights': ['The discrepancy between the initial reasoning for selecting random numbers and the actual mathematical implications of the approach is highlighted, prompting a reevaluation of the strategy.', 'Addresses the need to add 1 to the coordinate comparison to ensure elements are visible within the specified range, and demonstrates the correction to fix logical errors and ensure the proper functionality of the program.', 'Explains the reasoning behind the range 1 to 23 for random number generation and the correct formula for generating numbers within a specified range.']}, {'end': 4487.096, 'segs': [{'end': 3539.657, 'src': 'embed', 'start': 3492.046, 'weight': 0, 'content': [{'text': 'That means I need to go inside the wall.', 'start': 3492.046, 'duration': 1.72}, {'text': 'So to fix that, I will fix the coordinate issue and also a placement of most.', 'start': 3494.107, 'duration': 5.002}, {'text': "So let's first fix the coordinate issue.", 'start': 3499.149, 'duration': 1.64}, {'text': 'We go there, snake.collided.', 'start': 3500.829, 'duration': 1.821}, {'text': 'basically what we did was we had put something like this right, position.x is less than 1 and position.x is greater than width minus 1.', 'start': 3503.189, 'duration': 10.104}, {'text': 'so, going by the same logic, width minus 1 is going to be 49 because width is 15.', 'start': 3513.293, 'duration': 5.903}, {'text': 'so width minus 1 is going to be 49.', 'start': 3519.196, 'duration': 2.581}, {'text': 'so what you want?', 'start': 3521.777, 'duration': 0.84}, {'text': 'you want something greater than 48, not 49.', 'start': 3522.617, 'duration': 2.902}, {'text': "so it's going to be width minus 2, and that's a fixed issue.", 'start': 3525.519, 'duration': 4.802}, {'text': 'and um, For the other wall, which I just showed you there for the rightmost wall, what is happening is we are first drawing the board, we are moving,', 'start': 3530.321, 'duration': 9.336}], 'summary': 'Fixing coordinate issue for wall placement, adjusting width calculation.', 'duration': 47.611, 'max_score': 3492.046, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o3492046.jpg'}, {'end': 3626.879, 'src': 'embed', 'start': 3580.915, 'weight': 3, 'content': [{'text': 'Basically, they both mean the same thing, right? For the next loop, the starting point is going to the end of this loop.', 'start': 3580.915, 'duration': 5.662}, {'text': 'So they mean the same thing.', 'start': 3586.597, 'duration': 1.621}, {'text': 'now this should fix that issue that you are not seeing the snake colliding and now you should see that the snake actually collides with the wall before ending this game right so it went inside the wall and the game ended,', 'start': 3589.978, 'duration': 15.467}, {'text': 'and now everything is pretty much fixed.', 'start': 3605.445, 'duration': 2.081}, {'text': "and now let's proceed to making this snake game a real snake game.", 'start': 3607.526, 'duration': 5.002}, {'text': "what is that we need to include the snake's body.", 'start': 3612.528, 'duration': 3.106}, {'text': "We are just growing the snake, which is basically just increasing the length, right? So here you can see it's just increasing the length.", 'start': 3615.714, 'duration': 5.942}, {'text': "So how can we store the snake's body??", 'start': 3622.297, 'duration': 2.401}, {'text': 'Well, what is a body?', 'start': 3625.638, 'duration': 1.241}], 'summary': "Fixing collision issue and adding snake's body to the game.", 'duration': 45.964, 'max_score': 3580.915, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o3580915.jpg'}, {'end': 3917.66, 'src': 'embed', 'start': 3886.633, 'weight': 5, 'content': [{'text': "but to keep this tutorial simple, I'm using vectors for this particular demonstration.", 'start': 3886.633, 'duration': 5.397}, {'text': 'So I would totally encourage you to go with list, not with vectors, as we are going to see in this video and just showing with vectors,', 'start': 3892.41, 'duration': 9.084}, {'text': "because it's easier to relate than this, right?", 'start': 3901.494, 'duration': 2.141}, {'text': "But once you're comfortable by implementing this particular project in a vector, please go on to try it with a list.", 'start': 3903.995, 'duration': 7.102}, {'text': "List is the most preferred option for such games where you don't have to control the capacity of the user right?", 'start': 3911.317, 'duration': 6.343}], 'summary': 'Encourages using lists over vectors for simplicity and ease of use, especially for games.', 'duration': 31.027, 'max_score': 3886.633, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o3886633.jpg'}, {'end': 4080.645, 'src': 'embed', 'start': 4050.189, 'weight': 6, 'content': [{'text': 'And this defines the body of the vector.', 'start': 4050.189, 'duration': 1.921}, {'text': 'Now, there are a few changes we need to make.', 'start': 4052.47, 'duration': 1.641}, {'text': 'What is that? First of all, we need to include the head to the body here.', 'start': 4054.232, 'duration': 3.322}, {'text': 'Once we create a new snake.', 'start': 4058.166, 'duration': 2.582}, {'text': 'so in this snake called unshifted, what we are going to do?', 'start': 4060.748, 'duration': 4.664}, {'text': 'we are just going to say body.pushback, which is basically pushing back the elements inside a vector.', 'start': 4065.412, 'duration': 6.066}, {'text': 'And what we need to push back, we need to push back the position, which is basically the position of the head of the snake.', 'start': 4071.838, 'duration': 5.605}, {'text': 'We can just body.pushback that particular position.', 'start': 4077.983, 'duration': 2.662}], 'summary': "The snake's body is modified by adding the head position to it using a vector and pushback operation.", 'duration': 30.456, 'max_score': 4050.189, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o4050189.jpg'}, {'end': 4462.296, 'src': 'embed', 'start': 4433.473, 'weight': 7, 'content': [{'text': 'sorry, snake body of that particular index dot x.', 'start': 4433.473, 'duration': 5.824}, {'text': 'if these things match up, then what we need to do?', 'start': 4439.297, 'duration': 3.282}, {'text': 'you need to display a body part.', 'start': 4442.579, 'duration': 1.801}, {'text': "so let's just go with this small o.", 'start': 4444.38, 'duration': 2.322}, {'text': 'for now, this is our body part and this body part becomes true, equal to true, and what else?', 'start': 4446.702, 'duration': 7.425}, {'text': "well, we don't want to run this thing right, because at an instant a particular body part can stay only at a particular location.", 'start': 4454.127, 'duration': 8.169}], 'summary': 'Matching conditions to display body part and avoid running at same location.', 'duration': 28.823, 'max_score': 4433.473, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o4433473.jpg'}], 'start': 3492.046, 'title': 'Fixing coordinate issue and snake game logic', 'summary': "Discusses fixing coordinate issue for walls in a game, adjusting position.x and width values to ensure correct placement, and the logic and implementation of the snake game, addressing collision detection and introducing the concept of storing the snake's body as a collection. it also covers using vectors in c++ to define and manipulate the snake's body, utilizing push_back and erase functions, and checking for coordinate matches.", 'chapters': [{'end': 3539.657, 'start': 3492.046, 'title': 'Fixing coordinate issue for walls', 'summary': 'Discusses fixing the coordinate issue for walls in a game, adjusting the position.x and width values to ensure correct placement, such as setting width minus 2 for the rightmost wall to prevent drawing issues.', 'duration': 47.611, 'highlights': ['Adjusting position.x and width values to fix coordinate issue for wall placement, such as setting width minus 2 for the rightmost wall.', 'Identifying the correct value for width minus 2 as 48 to fix the coordinate issue for wall placement.', 'Addressing the issue of drawing the board and moving for the rightmost wall placement.']}, {'end': 4003.872, 'start': 3539.657, 'title': 'Snake game logic and implementation', 'summary': "Discusses the logic and implementation of the snake game, addressing issues with collision detection and introducing the concept of storing the snake's body as a collection, while emphasizing the preference for using a list over vectors or arrays due to capacity considerations, and providing a simple demonstration using vectors.", 'duration': 464.215, 'highlights': ["The snake's collision detection issue is fixed by updating the position of the snake's body after it moves, ensuring that collisions with the wall are correctly detected, resolving the game-ending problem. The chapter addresses the issue of the snake's collision detection by emphasizing the need to update the position of the snake's body after it moves, ensuring proper detection of collisions with the wall, thereby resolving the game-ending problem.", "The concept of storing the snake's body as a collection is introduced, with emphasis on the preference for using a list over vectors or arrays due to capacity considerations and the dynamic nature of the game. The chapter introduces the concept of storing the snake's body as a collection, highlighting the preference for using a list over vectors or arrays due to capacity considerations and the dynamic nature of the game.", "The demonstration of using vectors for the snake's body storage is provided, but the preference for using a list is emphasized for future implementations due to its dynamic nature and lack of capacity restrictions. The chapter provides a demonstration using vectors for the snake's body storage, emphasizing the preference for using a list for future implementations due to its dynamic nature and lack of capacity restrictions."]}, {'end': 4487.096, 'start': 4005.011, 'title': 'Implementing logic with vectors in c++', 'summary': "Discusses implementing logic using vectors in c++, including defining and manipulating the snake's body, utilizing functions like push_back and erase, and checking for coordinate matches in the snake's body.", 'duration': 482.085, 'highlights': ["Defining a vector to represent the snake's body and implementing logic for adding and removing elements using push_back and erase functions", "Explaining the process of checking for coordinate matches in the snake's body and displaying corresponding body parts"]}], 'duration': 995.05, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o3492046.jpg', 'highlights': ['Adjusting position.x and width values to fix coordinate issue for wall placement, such as setting width minus 2 for the rightmost wall.', 'Identifying the correct value for width minus 2 as 48 to fix the coordinate issue for wall placement.', 'Addressing the issue of drawing the board and moving for the rightmost wall placement.', "The snake's collision detection issue is fixed by updating the position of the snake's body after it moves, ensuring that collisions with the wall are correctly detected, resolving the game-ending problem.", "The concept of storing the snake's body as a collection is introduced, with emphasis on the preference for using a list over vectors or arrays due to capacity considerations and the dynamic nature of the game.", "The demonstration of using vectors for the snake's body storage is provided, but the preference for using a list is emphasized for future implementations due to its dynamic nature and lack of capacity restrictions.", "Defining a vector to represent the snake's body and implementing logic for adding and removing elements using push_back and erase functions", "Explaining the process of checking for coordinate matches in the snake's body and displaying corresponding body parts"]}, {'end': 5144.977, 'segs': [{'end': 4534.695, 'src': 'embed', 'start': 4487.096, 'weight': 0, 'content': [{'text': 'but remember, body includes the head right.', 'start': 4487.096, 'duration': 3.401}, {'text': 'so what we can do is we can just say body.size minus 1, which will basically leave out the last element.', 'start': 4490.497, 'duration': 5.982}, {'text': "and now this should work and let's try to implement this.", 'start': 4496.479, 'duration': 5.201}, {'text': 'so f9.', 'start': 4501.68, 'duration': 1.4}, {'text': 'and here you can see that the snake has grown.', 'start': 4503.08, 'duration': 2.021}, {'text': 'so the other food is over here.', 'start': 4505.101, 'duration': 1.5}, {'text': 'so well, i ate that and the third food is over here.', 'start': 4506.601, 'duration': 4.041}, {'text': 'well, you can see that the snake is growing right.', 'start': 4510.642, 'duration': 1.841}, {'text': 'so here you have four body parts of the snake and now, if i eat that here, now you have five.', 'start': 4512.483, 'duration': 7.467}, {'text': 'right. so now we have a working snake game, right.', 'start': 4519.95, 'duration': 4.221}, {'text': 'so now you have a working snake game and this works pretty fine, right.', 'start': 4524.171, 'duration': 3.342}, {'text': 'so now the you can see that the animation also works pretty fine.', 'start': 4527.513, 'duration': 3.361}, {'text': 'the body parts seem to follow the head and so on right.', 'start': 4530.874, 'duration': 3.821}], 'summary': 'Implemented snake game with 5 body parts, working and animated.', 'duration': 47.599, 'max_score': 4487.096, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o4487096.jpg'}, {'end': 4782.606, 'src': 'embed', 'start': 4753.441, 'weight': 5, 'content': [{'text': "well, i'm going left now, right.", 'start': 4753.441, 'duration': 1.781}, {'text': "so if i just press right, i'm just going to pull it with my neck.", 'start': 4755.222, 'duration': 3.322}, {'text': 'so basically i collided and now you can see that the process has stopped.', 'start': 4758.544, 'duration': 4.623}, {'text': 'basically, our collision algorithm is working.', 'start': 4763.167, 'duration': 3.582}, {'text': 'so that basically ends this.', 'start': 4766.749, 'duration': 2.862}, {'text': "and if you want to make a teleportable wall, it's really simple.", 'start': 4771.157, 'duration': 4.023}, {'text': 'what you need to do is, I am sure many of you must have figured it out right now.', 'start': 4775.18, 'duration': 5.084}, {'text': 'well, you just need to play with the coordinates.', 'start': 4780.264, 'duration': 2.342}], 'summary': 'Collision algorithm is working, making a teleportable wall is simple by playing with coordinates.', 'duration': 29.165, 'max_score': 4753.441, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o4753441.jpg'}, {'end': 4879.867, 'src': 'embed', 'start': 4858.84, 'weight': 3, 'content': [{'text': 'that is how you make data portable walls and once you get to know about file handling basically how to write files what you can do is you can even have a high score option,', 'start': 4858.84, 'duration': 10.164}, {'text': 'so you can write down a particular high score on the file.', 'start': 4869.004, 'duration': 4.081}, {'text': "so let's say i open this game right now and i scored about 10 points and you scored about 1000 points.", 'start': 4873.085, 'duration': 5.642}, {'text': "that's pretty reasonable.", 'start': 4878.727, 'duration': 1.14}], 'summary': 'Learn file handling for high score in game development.', 'duration': 21.027, 'max_score': 4858.84, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o4858840.jpg'}, {'end': 5105.056, 'src': 'embed', 'start': 5080.319, 'weight': 6, 'content': [{'text': 'And that really looks good, instead of the console, right? So basically what we are learning here is how to think.', 'start': 5080.319, 'duration': 7.384}, {'text': 'And console is the best way or the best platform to actually put down our ideas in a very fast way.', 'start': 5088.283, 'duration': 6.824}, {'text': 'But if I want to do the same thing in a graphics library, it will take a really long time.', 'start': 5095.387, 'duration': 4.822}, {'text': 'I need to ensure the graphics library.', 'start': 5100.269, 'duration': 1.701}, {'text': 'I need to do a lot of things before getting all these things right?', 'start': 5102.335, 'duration': 2.721}], 'summary': 'Learning to think using console for fast idea generation, graphics library takes longer.', 'duration': 24.737, 'max_score': 5080.319, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o5080319.jpg'}], 'start': 4487.096, 'title': 'Implementing games', 'summary': 'Covers the implementation of a snake game with a growing snake and successful animation, and the creation of a teleportable game with collision handling, high score potential, and suggestions for graphics libraries usage.', 'chapters': [{'end': 4534.695, 'start': 4487.096, 'title': 'Snake game implementation', 'summary': 'Demonstrates the implementation of a working snake game with the snake growing in size as it eats food, resulting in a successful animation and functioning game.', 'duration': 47.599, 'highlights': ['The snake grows in size as it eats food, with the body parts increasing from four to five upon consuming the third food.', 'The implementation results in a working snake game with successful animation and functioning body parts.', 'The code adjusts the body size by excluding the last element to ensure the game functions properly.']}, {'end': 5144.977, 'start': 4534.695, 'title': 'Creating teleportable game and handling collision', 'summary': 'Explains the process of creating a teleportable game, handling collision, and the potential for high scores through file handling. it also suggests considering the use of graphics libraries for enhanced game development.', 'duration': 610.282, 'highlights': ['The chapter explains the process of creating a teleportable game, handling collision, and the potential for high scores through file handling. It provides insights into creating a teleportable game, setting up a scoring system, handling collisions, and the potential for high scores through file handling.', "The game's scoring system is discussed, with the ability to increase the score by eating objects, and the possibility of implementing a high score option through file handling. The scoring system involves increasing the score by eating objects and the potential implementation of a high score option through file handling.", "The process of handling collision in the game is explained, ensuring that the collision algorithm works effectively and the game stops when a collision occurs. The explanation covers the effective collision algorithm and the game's response to collisions, ensuring the game stops when a collision occurs.", 'The suggestion to consider using graphics libraries for enhanced game development, providing smoother gameplay and the potential for implementing various visual elements. The suggestion emphasizes the use of graphics libraries for smoother gameplay and the implementation of visual elements to enhance game development.']}], 'duration': 657.881, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/AxrQje7V65o/pics/AxrQje7V65o4487096.jpg', 'highlights': ['The snake grows in size as it eats food, with the body parts increasing from four to five upon consuming the third food.', 'The implementation results in a working snake game with successful animation and functioning body parts.', 'The code adjusts the body size by excluding the last element to ensure the game functions properly.', 'The chapter explains the process of creating a teleportable game, handling collision, and the potential for high scores through file handling.', "The game's scoring system involves increasing the score by eating objects and the potential implementation of a high score option through file handling.", 'The process of handling collision in the game is explained, ensuring that the collision algorithm works effectively and the game stops when a collision occurs.', 'The suggestion emphasizes the use of graphics libraries for smoother gameplay and the implementation of visual elements to enhance game development.']}], 'highlights': ['Different variations of the game include teleportable walls and obstacles.', 'The objective is to grow the snake as long as possible without hitting yourself or hitting one of the others.', 'The simple version features four concrete walls and empty space in between.', 'Defining the game board with dimensions of 50x25 characters', 'The snake class is being defined with private variables like position, length, direction, and velocity to control the movement, with a focus on the number of characters moved at a time.', 'The chapter explains the logic for generating a random position for food on the board and retrieving the current food position using quad get position.', 'The video discusses tracking the game over status, handling collisions, and updating game features, with a plan to increase snake length visually.', 'The discrepancy between the initial reasoning for selecting random numbers and the actual mathematical implications of the approach is highlighted, prompting a reevaluation of the strategy.', 'Adjusting position.x and width values to fix coordinate issue for wall placement, such as setting width minus 2 for the rightmost wall.', 'The snake grows in size as it eats food, with the body parts increasing from four to five upon consuming the third food.', 'The implementation results in a working snake game with successful animation and functioning body parts.', 'The code adjusts the body size by excluding the last element to ensure the game functions properly.', 'The chapter explains the process of creating a teleportable game, handling collision, and the potential for high scores through file handling.']}