coding the drinking game "kings"
3 views (last 30 days)
I am supposed to code a game as a final project for my class and I was thinking that coding the drinking game "Kings" would be simple. Basically you pick a card and whatever rank you pick, there is a certain action you must do. So if you pull an ace, you must waterfall your drink. So there would just be 13 actions associated with the game that is it. I am not very good at coding and was hoping someone could show me how to start and then give me steps in completing this game.
Vimal Rathod on 3 Dec 2020
From the comments what Walter meant was to assign each card with numbers such as 0-12 for spades, 13-25 hearts and so on. So when you do randperm(52) you get random numbers that means the cards are shuffled.
You could use mod function to do modulo of that number. Suppose the number is 16 you do modulo of 13 and you get 3 which means the card has a number 4 on it and as its above 13 you have assigned it to hearts.
Refer the following link for modulo Function.