 Hey guys it's MJ the student act tree and what I want to show you in this video is my little poker game and what we want to do is how do we check to see if these cards actually make a straight. Oh we actually almost got the straight there Ace we just missed the two. So how do we check to see if we actually have a straight or if we have say a flush. Now a flush is quite easy to do in the sense that what we just need to do is we need to check if all the suits are the same then it is a flush. Remember in my my previous video how I'm drawing the cards is each card has got two random variables. The first random variable determines the suit and the second random variable determines the number. So we can yeah the first is is it a heart a club a spade a diamond the second is that you know a one or the way to 13 which represents the king. So what I want to do for the flush is I'm simply checking to see if the five suits are the same but now what happens if it is a you know straight flush how are we going to get to that situation. What I want to do is I need to now check to see if the numbers now match but the first thing I need to do is I need to order the cards. So what I do is I use a very simple bubble sort method I mean this is you know high school stuff download it basically I put my cards into an array I then search the array to make sure that you know you do arrange them if this one's bigger than that one you know they swap around and stuff like that. This is the supplementary method that goes with it and so you use the bubble sort to order the cards from high five all the way to high one but now poker has an interesting rule in that the ace can either be a one or it can be a 14. You know you can get 10 jack, queen, king, ace or you could go ace, two, three, four, five. So what I've done here to check it's a straight flush I first check to see if it is a flush and then I have an if statement inside to say you know if the highest one is equal to the second highest plus one and it's equal to the third highest plus two and it's equal to the fourth highest plus three and it's equal to the fifth highest plus four or or the the first highest is what you call it equal to the first highest plus 12 so that's checking for the ace you know king ace idea and then what we do is we say simply it's a straight flush and we multiply the winnings and we have a nice little display you know say yay you've got a straight flush. Also what I do is if it's not a flush it can still be a straight and then I'm just gonna basically go to this high you know order the cards and then check to see if they are in like that and then if that's not the case then it's just a high card result. I will make another video to show you how I do the one pair two pair three pair sorry three of a kind full house and four of a kind because that uses a slightly different method but feel free to download this app I have put a little link in the description below ooh we've got three of a kind there let's see if we can go for the full house no we didn't go for the full house but it's quite a cute little game let's see should we go for let's go for the straight okay no we didn't get the straight I'm actually horrible at poker but yeah that is the that's how you do it and check out my other video for how we're gonna do or how we're gonna check for these results see you then cheers guys