Problems with arrays :)


Sorry if it is a very stupid question. Im trying to adapt a memory game learned in YT channel of BornCG.

My idea is to teach an asotiation of cards but for now I want to take a full deck of cards, shuffle it, divide in half and fill the grid with two groups of the same 26 cards. No matter what I do I get a grid of twenty six.

Here is the code I use:


In the fill deck I create the deck. Im create new deck I shuffle it, divide the array and create a new deck with two copies of the divided array. If I print the new deck size it seems ok.

That make me think that the problem is filling the array in the dealDeck function.

Hope to solve it because afterwards I will have to work to have each card with two different images :).

In case it is interesting to you, I´m making it to help card magicians to rehearse on card memory work.


  • a
    andrewjhaugen replied

    The only thing that kind of jumps out at me is in your dealDeck function where you go "for i in newdeck.size()" I tried with "for i in newdeck" and I was able to get 52 instances to add to the grid. Let me know if that works for you.