 And welcome to How to Create a Deck of Cards using object-oriented programming classes and rendering through the class. Now this is something I haven't done before, and I'm doing it kind of live here, so hopefully this will go well. One of my students is doing a similar project and I wanted to see if I could do it myself. So first quick shout out to my members. Thank you so much for supporting the channel directly. If you'd like to join, click the join button down below. So let's take a look at what we've got. Nothing. OK, so what I want to do is I want to create a deck of playing cards. So that's ace, king, queen, jack, 10 down through 2. And we have clubs. Let's see what's the clubs, spades, diamonds, and hearts. So I want to do a couple of things, like simulate the cards themselves. And I want to be able to draw them on the screen. I'm going to be doing that. I'm going to be using the turtle module, which I use a lot. So I'm going to go ahead and import turtle. And for those of you who've been following my channel for a while, that should be very familiar. And turtle.screen, and win.bgcolor. I'll make the background color black. Doesn't have to be that. I'll say win.setup. I'm going to make it 800 wide by 600 tall. And let's see here. What else can I do with the window? Oh, win.title. And we'll put a nice title there. I'll say deck of cards simulator by at Tokyo EdTech. Speaking of Tokyo, I'm sitting in Tokyo right now. It is very, very dark outside. And there is a thunderstorm warning. So if you hear some thunder and lightning, don't be surprised. So I'm going to scroll down a bit here. And I'm going to put win.mainloop to keep my program open. I'm just going to run it right now and check. And notice I'm using the Genie editor. I highly recommend it. And if I run this, now I've got two screens going. And there is my deck of cards simulator. So what I want to do is I want to be able to put some cards here on the screen. And again, I haven't done this before. So we're kind of making it up as I go along. But I have a pretty good idea of how to do what I want to do here. So what I want to do is I'm going to go ahead and create some classes. Now, if you haven't done classes before, I'm going to check out my OOP introduction to object-oriented programming and classes tutorial. I think it's worth your time. So what I'm going to do is I'm going to create a class for a card. And in my constructor, I'm going to create the card. And I'm going to create its each card has a name and a suit. So the name would be Ace, King, Queen, Jack. I'm going to use A, K, Q, et cetera, et cetera. And suit is one of the four suits that I mentioned previously. So I'm going to say self.name equals name. And I'm going to say self.suit equals suit. And what I'll do for suits, I'll use D for diamond. I'll use S for spade. What's the other ones? I keep forgetting. C for clubs and H for hearts. And when we render it, we're going to render it a little bit differently. We're going to try and make it look like the symbol. But for now, we'll leave it like that. Speaking of the symbol, if you're not familiar with playing cards, they look like this. I don't know about the pattern. I don't think I'm going to do that today. But I do want to get seven of clubs, seven of hearts, et cetera, et cetera. I won't be able to get it upside down because I don't know how to do that with the turtle module. But I do want to use these symbols. So let's get back to the code. And now, here's a question. At this point, what should I do first? Do I want to deal with the deck and make 52 cards? Or do I just want to make one card and see if I can get it working? And basically, what I usually do is I start from the bottom up. So in this case, I would just try and get one card working. Because once you have one card working, the rest of it's pretty simple. So what I'm going to do is I'm going to create a pen. Actually, let's do it. Let's not do that part first. Let's go ahead and just create a card. So card, very original, equals card. Now notice it says self. Now self comes from here. So card is self. And the name and suit. So of course, it's going to come as no surprise. I'm going to do the ace of spades. So what I can do is I can make a function called print card self. And we'll keep this really simple. So print self.name and self.suit. And so then what I'll do is I'll create a card and I'll say card.print card. I could call it card.print, I guess. But let's call it print card. And let's see what happens. Let's run it. So now the window is still coming up. But because I'm printing, it's coming up here. So ace of spades. So I'm pretty happy with that. So far, so good. Now what I could do is something like this instead is maybe let's do an F string and some parentheses here. Or that parentheses, but braces. I don't know if you can hear the wind picking up outside. It's getting pretty loud, so I apologize for that. And let's hopefully the electric doesn't go out. That's pretty rare here, but it does happen. Let's go ahead and run that. So that is the ace of spades. But what I want to do is I want to actually have those symbols. And as you saw earlier, I already had the Wikipedia article open. So I'm just going to go back here and I'm going to go ahead and copy these symbols out of here. So I'm going to copy this whole thing and then delete what I don't need. And come back to that. And so what I'm going to do, so I'm going to say symbol. I don't know what symbol, I don't want us to call it equals that. So if self.suit equals, well, here's one thing I could do. Self.suit equals s, which is for spades. Now it's a symbol equals, and I'll use the spade symbol. So I'm just going to comment this out for now. I'm just going to test that to see if it works. And we're going to run it. And that did not work because I want to now print not the suit, but I want to print the symbol. Let's close that and try to get. OK, so you can see now I've got ace of spades here. So I'm pretty happy with what's going on so far. So thinking about this, now I could do four if statements because there's only four. But probably what you want to start doing is stuff like this. So symbols equals, and we could use a little dictionary. I'm doing a lot of Java lately, so I've been throwing a lot of semicolons in where they don't belong. And so we have four of these. So we're going to do diamonds, clubs. And note, I could use these symbols, but I want to keep it so that I can type stuff in if I need to. And spades. And then I'm going to copy the symbols and hearts. And I know my keyboard is a little loud as well. I've got to get a new one, but I'm kind of waiting until Kroner's over, I think, hopefully, which will hopefully be soon. So what I can do now is I can do something like this. I can do symbols, and then I can just do like this. I can do self.suit. Now I'm going to test that and see what happens. Just got to close the old one first, and we still get an ace of spades. So I'm pretty happy with that. Now I should test it and make sure it works. But what I want to do here is I want to go ahead and start rendering. And how I'm going to do that, as I mentioned earlier, I'm using the turtle module. So if I'm using the turtle module, I need to have something to draw with. So I'm going to go ahead and create a pen. Now I don't have to call it pen, but that makes sense because I'm drawing. So pen equals turtle.turtle. Again, if you've seen my tutorials before, you know this is kind of how I do things. So I'm going to say pen.speed equals, what's that, speed 0? That's the animation speed. And I'm going to say pen.hide turtle. So I don't need to see the pen. I just need to see what the pen can draw. So I'm going to go ahead and I'm going to make a new method. And I'm going to call this render. Let's call it render, I guess, self. And x comma y. Oops. Using the pen. So here's what I'm going to do. I'm going to say pen.goTo. I'll say pen.penup just to make sure. pen.goTo x comma y. And then what I've got to do is I want to choose a color based on, actually, that's how we'll do the border first. I'm going to say pen.color white. Now, think about what the card looks like. Let's go back to this. So you see how the card is taller than it is wide. So that's probably what about 2 thirds give or take. So I'm going to decide how big I want the card to be. And then here, we're going to be drawing from the center. So if this is the center of the card, I want to go up to this corner and start drawing an outline. There's a big lightning strike just out the window here. So we should hear that shortly. So I'm going to basically be drawing the outline. So let's go ahead and try that. I'll get back to, there it was. OK, so I'm going to say pen.goTo x, we'll say x minus 50. And then we'll say y plus 75. I'm going to say pen.pendown. And I'll say pen.goTo x plus 50, y plus 75. So I'm drawing top left, top right. I'm going to go bottom right, bottom left, back up the top. So pen.goTo x plus 50, y. Ooh, this should be minus. No, this is correct. Minus 75, pen.goTo x minus 50, y minus 75. And pen.goTo, let's see, x minus 50 back to the top, y plus 75. So what we're going to do is I'm going to say card.render. We're just going to put it 0 comma 0. And we're going to use the pen. Let's see if that works. Oh my gosh, it looks really good, actually. That's exactly what I wanted, size-wise. Now what I'm going to do is I'm going to go ahead and I'm going to comment this out just so you can see what's going on. I'm going to bring this up. Oops, it's way too fast. OK, tell you what I'll do. I'm going to hit delay. I'm going to say delay equals input. So that'll let me delay it. You'll see in a second. So I'm going to pull this up. And then down here, that's the wrong screen, hit Enter. And then, no, you can't see that. OK, lovely. All right, duh. So I'm going to go ahead and import time. So import time. So I can do time.sleep. So time.sleep, three seconds. That'll just give me three seconds to get the screen on. Here we go. And it's going to start drawing. So you saw it started here, went here, went down here, went over here, went up here. So it works. I'm pretty happy with that. So what I want to do then is, so I'm going to say here, let's see, draw the border first. Now I'm going to draw, say draw suit in the middle. So this is pretty simple. So I'm going to say, I'm going to put pen.penup. So we don't draw any more lines. I'm going to say pen.gotue. Go back to the center, which is x comma y. And I'm going to say pen.write. That's going to be self.suit. Ooh, no, no, no, that's not correct. Because I need the symbol. So all right, what I'm going to do is I'm going to move this out of here. I'm going to put that up here. So let's see here. Self, I want to do it that way. I'll do that way for now. I know it's not super efficient, but we'll leave it like that. So I'm going to make it self.simbles. Self.suit, OK? And then I'm going to write self.simbles. Self.suit, this should be false. And then I'm going to use a font. So font equals, I'll use carrier. I like carrier. Carrier new. Let's try 32. I don't know how to pick a number. And let's go here normal. Don't forget the last quote. There's another big lightning strike out the side here. OK, so I'm going to try this and see what happens. So you can see it's a little bit off. So it's not quite centered as I would have liked it to be. So I'm going to have to play around with the numbers a little bit. It's also not as big as I'd like. Let's make it 64 and see what happens. Oh yeah, that's more what we're talking about. So you can see how it's not centered. Why is that? Probably, yeah, I know why it's doing that. So I'll show you why it's doing that. I'm going to like unhide the turtle. And you'll see why it does that, just so you know. So you can see the turtle's here. But for whatever reason, the text is printed up here. I don't know why it does that. Maybe somebody does. I just think it has something to do with the way the rendering is done. I'm going to have to 48. That was a little big. So what I'll do is I'm going to go to XY. I'm just going to play around the numbers a little bit. And since it's 48, let's try 24. And 24. I don't know if that's enough, but let's see if it works. It's pretty close. It's close to being centered. So I think it's probably going to depend on the font and the size of the font. There might be an easier, better way to do this. I don't know what it is. But I'm going to go ahead and just kind of play around. I want it to come down a little bit and a little bit to the right. So I'm going to make that, let's see, 18. And I'll make that 30. You may have to have different numbers depending on how your computer is set up. OK, now that's pretty well centered. I'm happy with that. So I'm going to hide the turtle again. Well, actually, it doesn't matter. I'm going to hide the turtle. I don't need to see that. So now I want to add, as you have here, I want to add the seven of the ace of diamonds or ace of spades here. Now those of you who like music, you know why I chose the ace of spades, out of respect to Lemmy and Motorhead. Actually, it was online next to Lemmy one time in Bucharest. Yeah, he was just right there at the airport. And I didn't have the courage to say anything to him. But I was really close to Lemmy. It was pretty cool. Anywho, let's see. Draw, top left. OK, so let's say pen.go2. And again, I just got to kind of play around with the numbers a little bit. So I'm going to try 40. I don't know. It's 50. And plus 75, so I'll try plus 65. X minus 40. So it's the center, wherever we drew it at. And I'm going to go ahead and copy this, because I like to tell my students I'm kind of lazy. So I'm going to do the symbol and the name. So self.name. And this has got to be a lot smaller. I'm going to try 12. And I want this to be lower. So I'll try 55 with this. You can see the process. I don't know quite what I'm doing. I'm just kind of experimenting until I get what I want. OK, well, it's not too bad. So you can see how it's just a little bit too high. So I think the size isn't too bad. Maybe a little bigger. Let's make it, let's try 18. And again, this will depend on your fonts and your computer a little bit. So let's make that 155. Make this 140, since I made the font a little bigger. Oh, it's really close now. So I'm just going to move those down a bit. Say 45. Yeah, I can look at that. Not too bad. So there's our ace of spades. And I'm going to go ahead and I'm going to put this in the bottom right. So I'm just going to copy this. So I'm kind of like I said, I'm kind of a lazy guy. I don't believe in repeating myself. And so I'm going to draw the bottom right. And I know it should be upside down, but I don't know how to do that with the turtle module. So yeah. Anyway, so this should be x plus 40, because we're going to the right side. And I'm going to try y minus 45 and y minus 30. Let's see what happens. Now I think it's going to flip them, but ooh, it's not even close to where I wanted it. Yeah, I think it's because of the way the turtle. Yeah, it's weird. But anyway, so we've got to move it over to the left a little bit. So let's make that 30. And let's try that again. I think I'm just doing a little bit of experimentation. Now I don't like that. Now normally this would be reversed upside down, but unfortunately that's not going to be the case here. So let's flip this around. And you can see how there's just this process of kind of iteration. And I can't draw it out because I don't know really the right size. I don't know how big everything is and how the offsets work on this. So yeah, it's kind of annoying actually. But anyway, live and learn. So we need them to go down a little bit more. So let's say 45 and 60. I think there's 15 apart here. Oh, it's so close. So you can see how close that is. I'm going to go ahead and try 55 and 70. OK, I'm pretty happy with that. OK, so we got the ace of spades. And now the other thing I would probably want to do at this point is actually, what I'm going to do is I'm going to change the background color. Well, let's see here. With the turtle model, I know there's a way to fill in this background, but I forget how to do it. OK, well, this is how we figure these things out. Let's go ahead and try it. So yeah, you can see my old stuff I look at in search. So Python turtle module. And you see I'm using duck duck go. So yeah, so control fine and fill. So it's begin fill and end fill. OK, so control fine and be in fill. OK, so I think how this works. Let's try this. I'm kind of curious. I did it once before, but it's been a while. Pen go to, OK. So pen dot begin fill, pen dot end fill. And I think what that will do, let's see if it works. Fudge, it's underscore. Let's try that again. Yes. So what it did was it filled in that area. So it goes to begin fill, you draw an enclosed shape, and then it fills it in for you. That's pretty cool. I'm pretty happy with that. So what I want to do is I'm going to change the color. So instead of white, I'm going to make the cards blue. And then what I'm going to do with the suits and everything is I'm going to draw that in white for now. So pen dot color, white. Let's see what that does what I wanted to do. Oh my gosh, that looks cool. Hey, there's my playing cards. That is pretty, pretty cool. So I can live with that. I'm pretty happy with that. These spades, cool. Now the other thing I might want to do, the color, instead of white, for the symbols, if it's spades or clubs, I could make, well, I'm going to leave it white for now. I'm going to get a little tired at this point. Sorry. So we can probably figure it out, I guess, if we want to change the colors. So just a quick rehash of what we've done here is we've created a simple turtle window, a turtle pen, a card class. It has a name, suit, and a list of symbols. So we can convert the D to a diamond, the C to a club, and H to hearts, S to spades. And then we have a print card. So if we wanted to print that out down here, we could do that. But what we really want to do was to render it. And you can see I just kind of played around with the numbers until I got it looking how I wanted to. I used the begin fill and end fill to create a closed area that's filled in. And again, you can play around with the colors and things. And I just used the pen write method and go to some very simple stuff. And again, I just kind of played around with the numbers. If you have a different font or a different computer, you'll probably have to play around with the numbers a little bit to get things where you want them to be for your machine. Now, of course, you could use a pre-made image. So now I look at that little bit. It's a little bit extra space. They're going to move that down just a little bit. So I'm going to make that 60. I'm going to make that 175. Now, the advantage of doing it the way I'm doing it is the fact that you don't have to have any external images. You can see everything's being done with this one file. And so that's that. Now, that was one card. So here's what we want to do is now we want to create an entire deck of cards. Now, at this point, I guess you could just stop and say, OK, well, I see what I have seen. I've done what I've done. This is actually probably a really good place to stop because you can draw basically any arbitrary card. So I can make a space. Let's say a king of diamonds. I should probably test it. And let's see here. And you can see we've got a king of diamonds. Now, maybe I don't need the diamond because we've got a diamond here. I don't know if that's overkill. But you can design your card however you like it. So what I'd probably do at this point is go ahead and start making a deck. So now I'm going to make a new class called deck. And I'm going to initialize it. And let's see here. Self. And I'm going to create a deck. A deck is made up of cards. So cards. So I made a list of cards. And what I'm going to say is, let's see here, cards. OK, so we've got names. And the names of the cards are ace, king, queen, jack, 10, 9, 8, 7, 6, 5, 4, 3, 2, and there's no one. So aces can't have a value of 1 or 11, black jack, depending on the game. And then the suits is going to equal. We've got diamonds. I like to keep things in the same order. Diamonds, clubs, hearts, spades. So diamonds, clubs, hearts, and spades. So what I'm going to do is the following. So for name in names, for suit in suits. Doesn't matter which order you do it in. Since that's the way I did it, we'll do it that way. I'm going to create a new card. And it's going to be name and suit. And then I'm going to append that card to the cards. Now, what I'm going to do now is I'm going to go ahead and create a deck. So I'm going to say deck equals. And I'm going to try this. I'm going to say for card in deck.cards, card.print. And what that should do is give us a printed list of all the cards. And instead, it gave us an error. So ah, duh. There should be self.cards. Sorry about that. So hopefully some of you figured that out. Self.cards. Now, this names in suits is not self, because I don't need access to these outside of that. So let's go ahead. And there we go. So you can see how it works. So ace of diamonds, clubs, hearts, spades. King of diamonds, clubs, hearts, spades, et cetera, et cetera. And I've got all of my cards. Now, at this point, I can kind of play around with it a little bit. Let's go ahead and see what we got here. So again, we want to try and render all these cards. So let's go ahead and just do a card.render. And I'm going to render them all at 0, 0, and using that pen. Now, I'm going to go back up here and get rid of pen speed, because I want it to be slow. So let's see what happens here. So what it's doing is it's rendering all of those in order on top of, oh, we see the queen kind of overwrites that, because the queue is a big letter. You can see how the 10 is now outside of that. So we've got to deal with that. OK, so this is good. This has kind of given us an idea. Now also, you can see how this is still back here. So what we're going to want to do probably is, OK, think about that. Let's see what happens if I do this. I'm kind of curious. So it's clearing, drawing, clearing, drawing. It's a little bit slow, but we can speed it up with speed. So one of the things we had to fix was that the queue has that little hanging part down. So what I'm going to do is I'm just going to move this down just a little bit. So I'm going to make that 25. And that means I need to move this up just a little bit. And I need to move this down just a little bit. So that should be 80. So that should fix the queen problem. So I'm going to go back to get rid of this clear. OK, ace works, hearts works, ace is good, kings are good. Kings, kings, and queens. OK, queens are fine now. OK, but we still have the problem with 10. Because 10 is two characters wide as opposed to one character. So we have a choice here. What we could do is we could just make a special case in our rendering if the name is 10 and then we change the X location a little bit is one option. Or what we could do is change this to a T. That's kind of the lazy person's way of doing it. And I am nothing if not a lazy person sometimes. So I'm going to leave it. I think I'm going to go with the T thing. You can play around with the 10 thing if you'd like. Yeah, I'm pretty happy with this. Not bad for a quick video. So that was 33 minutes. Now there's a couple there's a T, yeah. So I think I'm OK with that. Again, you'd probably want to change that to a 10 just to make it look better. But I'm going to live with that for now. So thinking about a deck, of course, we don't want the deck to always be in that same order. So I'm going to go ahead and go back to card.print card. And then I'm going to go ahead and make a new method. So it's going to be called shuffle self. And so what I'm going to do is, OK. I haven't done this for a while. So I think I got to use the random module. So import random. And then what I'm going to do here is random.shuffle cards, self.cards. And this is a method of the random module. And it takes a list, which we created. We created a list of cards here. And it just shuffles them in a random order. So let's go ahead and run it. And OK, now nothing happened because I forgot to shuffle. So deck.shuffle. So I'm going to shuffle the deck. Let's try that. And there you go. You can see now we have a bunch of random in a random order. Let's go ahead and run it again. Just see if it comes out differently this time. And I think it did. So there is our deck. Pretty cool, actually. But what we want to do now, instead of printing that, is we need to pull cards off of the deck. So, well, do we? For this, are we just rendering? I guess, I guess. What can we do here? So basically at this point, we don't really need to worry so much about the card class. That's why I use classes. I'm done with that. So I'm going to say, Def, what could we do all this? Choose card, self. And choose card, get card. I'll call it get card. And I'm going to go ahead and do the following. Card equals self.cards.pup. And I'm going to say return card. OK, so I'm going to shuffle it. And I'm going to say card equals deck.getCard. And I'm going to say card.render. So what this will do is it will pop a card off of the deck, return it to me, and then I can render it. So I'm going to go ahead and do that. OK, duh. I'm going to render it somewhere. And I'm going to use the pen. OK, so it gave me the queen of diamonds. That's pretty cool, I guess. What I want to try, let's try this here. Let's see if it works. So I'm going to say for blank in range, let's say we'll just pull off 10 cards. And then time.sleep, five seconds. And then we'll say pen.clear. We'll clear the pen. So pen.clear just erases whatever the pen has done. OK, so what we're going to do is we're going to create a deck. So I'll put that in a common here. Create a deck, shuffle the deck, and then we're going to go ahead and render 10 cards in a row. So hopefully this will do what we want it to do. So we've got five of clubs, eight of clubs, seven of diamonds, three of clubs, six of diamonds. I'm pretty happy. It's working at least. It's doing what I wanted it to do. So let me go ahead and try that one more time just to make sure we got a different set of cards. There's seven of diamonds, queen of hearts, yeah. So clearly, as far as I can tell, it's working exactly as we wanted it to. And now what I could do at this point, what I might want to do is get five cards. And then we'll say start x equals, let's see, five cards, 50, 75, I don't know, we'll say minus 50 plus 125. So 175. Then what we'll do is we'll say, I'm going to do I, then I guess maybe x, I don't know. So we'll go x, say start x plus I times. And the width of each card is, what, 100? What was it? Back up to the renderer thing here. Go to negative 50, yeah. So cards are 100 wide. So let's see, 150, 300, 75, let's see, minus, I don't try minus 300, well, 250. And then times 125. I don't think we need that anymore. So what this should do is draw five cards on the screen. I think I is not defined. x, 2, 3, 4, and 5. That looks pretty centered to me. So there is our deck of cards simulator. Yeah, I didn't do quite a super explanation here, but I think you can go back and kind of figure out what's going on here. Now notice when I get a card, I don't know if I, I didn't really mention this, but when I get the card, it is now gone from the deck. So that deck does not have that card anymore. So it is no longer there. So probably what you want to do is to create a function. So def reset deck or something like that. And then probably what I would do is I would just copy this and just pop that in there. And then what that'll let you do is, you know, let's say you're playing a card game and then you give out some cards to some players. Okay, games, you know, that round is over. Then you just basically reset the deck and shuffle it. Don't forget to shuffle it. And that will put it back to its normal order. Now you could, you can go ahead and put shuffle in here. Say self dot shuffle. So it automatically shuffles itself after you reset it. So let's try that. Let's go ahead and see if this is working. So instead of shuffling deck, I'm just going to say reset. And I, and the reason it's separate is, you know, let's say you take out a couple cards then you want to shuffle them for some reason. Okay, so you have two separate functions to do that. Let's try it again. Deck object has no function reset, reset deck. I'm going to change that to reset. It's going to be a deck that's redundant and it is working as expected. Okay, you can see how it's rendering slowly. The only reason it's doing that is because I made it do that. So, because I wanted to be able to see what was going on. So if I put pen speed to zero and then it just, they just popped right up. You didn't see them pop, but that was kind of cool actually the way that worked. And then maybe, maybe you might want to have one more card. I'm not sure about this. So you might want to make a card, let me think about this. So something like this. So if the self.suit does not equal quote, or self., we'll say self.name. And I'll show you why I'm doing this in a second. So what you can do in, let's see how I'm going to do that. So what I'm trying to do is trying to figure out how to draw it face down. So what you could do is just create a card. So, let's see. So for example, I know I'll do, okay. So I'm going to take this, I'm going to double it and instead of taking the card from the deck, I'm going to say card, and it's going to be no name and no suit. And I'm going to say time.sleep, five seconds. Okay, hopefully this will do what I want it to. Yeah, there we go. So there is an empty card. And then after five seconds, boom, it prints the cards. So, yeah, that's a way to do it. And then when we were done, we would clear the screen. I'm really happy with that, that's pretty cool. Anyway, so there is your deck of cards simulator. Now I'm pretty happy with this, this is pretty cool. This turned out way better than I thought it was going to. But you can see, basically what I did one more time. So the card itself has a name and a suit. And again, I chose to use d, c, h, and s. And I also chose to use t instead of 10 because of the rendering. Now you could fix that if you wanted to. And then, but when I do render it, I want to have the diamonds, I want to have the club, I want to have the spade, or the heart and the spade symbol instead. So I have a print card method, if I wanted to make a text-based game. But I also have this render method that works with a turtle pen. So I can render it anywhere on the screen. And then if the card, so self-name is empty, is not empty, because we use that to represent the back of a card. Now I could make a method, render back of card or something like that, if I wanted to. I don't have to do it the way I'm doing it. It's just a way of doing it. Now, then I have a deck and it's basically made up of cards. And we have all the different names, we have all the different suits. Let me do a little nested loop here, create the cards, append them to the list. We can shuffle using the random shuffle method. We can get a card, and again, pop removes an item from a list. I forget if it's the first item or the last item, probably the first item, but I could be wrong on that. But once you shuffle, it doesn't matter, it's coming from the end of the beginning. And then we also need to be able to reset. And in the reset, we decided to shuffle. So we just created all these cards over again, delete the old list, and then recreated it. And then we created a deck. So deck is deck, and then we reset the deck, which shuffles it. And then, so basically when we do this, we could then, well, I guess that gives you a deck in order, so maybe there's a reason. So then basically what I did was I rendered five cards in a row, five cards, I'll put that in the back, in a row. And so I just started at negative 250, then jumped 125 each time, and it worked out, and I got lucky with the centering. It looks really cool, actually. And rendered each card, slept for five seconds, and then dealt five cards from the deck. And that, my friends, is that. Thanks for watching. Click like, subscribe, leave a comment. And if you're able to, please join as a member and get early access to stuff like this. Take care and keep on coding.