Card Game? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Card Game?

Im making blackjack (the card game) and i am also very new to coding, so sorry if i dont understand some terms. Anyways, ive created the deck, and the drawing system, but i wanted a function that made the array of cards reset - like a shuffle. Any help? Heres my code: https://code.sololearn.com/W0U8MCo44Bp0/?ref=app

12th Oct 2017, 6:03 AM
Polytiel
Polytiel - avatar
5 Answers
+ 1
12th Oct 2017, 7:56 AM
Calviղ
Calviղ - avatar
12th Oct 2017, 6:24 AM
Apoorva Shenoy Nayak
Apoorva Shenoy Nayak - avatar
+ 1
Yes! Thanks ;D
12th Oct 2017, 8:05 AM
Polytiel
Polytiel - avatar
0
You should set deck variable to constant, set another temp var for drawing var drawdeck = deck; To shuffle, you just need to reset cardsleft and drawdeck variables. Also remember to check cardsleft===0
12th Oct 2017, 7:17 AM
Calviղ
Calviղ - avatar
0
i dont understand what you mean Calvin sorry
12th Oct 2017, 7:23 AM
Polytiel
Polytiel - avatar