0

for my class assessment I'm doing a card game on app lab, so I made each card into a list of arrays and made the ace, jack, queen, and king as variables and also in the lists, I'm trying to move a random array to another list that will be my hand for the card and I have been digging through the API but it doesn't tell me and I cant think of a way of doing it without it running an error. I'm still pretty new to coding so sorry if its not that good here's my code so far

var A=1;
var J=11;
var Q=12;
var k=13;
var yourcards= [];
var AICards =[];
var chooseCard = randomNumber(0,51);

var cards = ["A", "2", "3","4","5","6","7","8","9","10","J","Q","K","A", "2", "3","4","5","6","7","8","9","10","J","Q","K","A", "2", "3","4","5","6","7","8","9","10","J","Q","K","A", "2", "3","4","5","6","7","8","9","10","J","Q","K"];

onEvent("War", "click", function(event) {
etScreen("gameGrounds");
});

 function CardDeal(){
    for (var i = 0; i < 25; i++) {
     chooseCard();




 }
}
treves tucker
  • 1
  • 1
  • 1
  • 1
  • You need to take a step back and find a way to represent cards of different suits. Otherwise if you randomly select the first `"2"` and then the next `"2"` how do you know which is which? (The first ways that come to mind are to use `"2d"` or `{suit: "diamonds", value: 2}` for "two of diamonds".) – nnnnnn Mar 28 '17 at 02:24
  • Refer to http://stackoverflow.com/a/2450976/7771883. Shuffle the `cards` array into a new array and then take turns dealing to the `yourcards` and `AICards` arrays with your loop and `i` counter. – Drewby Mar 28 '17 at 02:24

0 Answers0