# Hi, I have a error in my code please help project due (MEMORY GAME)

**URL:** <https://discourse.processing.org/t/hi-i-have-a-error-in-my-code-please-help-project-due-memory-game/16749>\
**Category:** Coding Questions\
**Created:** [December 31, 2019, 3:58am UTC](https://discourse.processing.org/t/hi-i-have-a-error-in-my-code-please-help-project-due-memory-game/16749 "2019-12-31T03:58:15Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![pothead](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@pothead](https://discourse.processing.org/u/pothead)\
**Post date:** [December 31, 2019, 3:58am UTC](https://discourse.processing.org/t/hi-i-have-a-error-in-my-code-please-help-project-due-memory-game/16749/1 "2019-12-31T03:58:15Z")

</div>

So I am trying to make a memory game with an AI that chooses cards after my turn and when you find pair of cards that matches, it deletes and moves it to the side.

I am having ARRAY OUT OF BOUNDS on my code  
if someone could help that would be great.  
data folder on google drive --\> here[Drive](https://drive.google.com/drive/folders/1kVqR5Ei5v4RSeQ3fOEidIuPQpgGv2OtA?usp=sharing)

```auto
import java.lang.Integer;
int alarm=-1;
ArrayList <Integer> mem =new ArrayList<Integer>(10);
ArrayList <Integer> AIpairs=new ArrayList<Integer>(12);
PImage[] cardPic = new PImage[13];
int[] card;// -1= empty 1-12 fromcardPic
boolean[] faceUp; // true= face false= back
int level=3; //1=easy 2=med 3=hard
int turn=0; //0-init 1=player 2=AI
int cols;
int cw;
int ch;
PImage wall, MENU;
int [] hand = new int[2];
int Count = 0;
int maxMem;
int scene =1;

void setup()
{
  size(1080, 720);
  for ( int i=1; i<14; i++)
  {
    wall=loadImage("wall.jpg");
    MENU=loadImage("MENU.jpg");
    cardPic[i-1] =loadImage("KIRENCOPIED ("+i+").png");
  }
}
void draw()
{

  if (scene==1)
  {
    if (turn==0)
      initGrid();
    if (turn==2 && alarm==-1)
    {
      AITurn();
    }
    showGrid();
    if (alarm==0)
    {
      checkMatch();
    }
    if (alarm >0 )
      alarm--;
  }
}
void initGrid()
{ 
  maxMem= level*2+1;
  mem.clear();
  AIpairs.clear();
  cols=3+level;
  cw=200-level*30;
  ch=250-level*35;
  println(turn);

  card= new int[4*(level+3)];
  for (int i=0; i<card.length; i++)
    card[i]=i/2+1;
  faceUp= new boolean[card.length];
  ////////////
  for (int i=0; i<faceUp.length; i++)
    faceUp[i]= false;

  ////////////////
  for (int i=0; i<hand.length; i++)
    hand[i]= -1;
  turn=2; ////////////////////////////////////////TURN =====================2
  shuffleIt();
}

//////////////////////////////
void shuffleIt()
{ //shuffle card[] - pick random index and swap and sawap value
  int r1, r2, temp;

  for (int i=0; i<card.length*2; i++)
  {
    r1= int(random(card.length));
    r2= int(random(card.length));
    temp = card[r1];
    card[r1] = card[r2];
    card[r2] = temp;
  }
}
void showGrid()
{

  image(wall, 0, 0, width, height);
  for (int i=0; i<card.length; i++)

    ///////////C = colloum and R = row///
  { /////////////////gap//side
    int c =i%cols*(cw+12)+50;
    int r =i/cols*(ch+12)+30;
    if (card [i]>0)
    {
      if (faceUp[i])
        image(cardPic[card[i]], c, r, cw, ch);
      else image(cardPic[0], c, r, cw, ch);
    }
  }
  for (int i=0; i<AIpairs.size(); i++)
  {
    image(cardPic[AIpairs.get(i)], 900, 20+i*ch/2, cw, ch); ///////// ARRAY OUT OF bOUNDS
  }
}
void mouseClicked()
{

  if (turn==1&& turn==2)
  {
    for (int i=0; i<card.length; i++)
    {
      int c =i%cols*(cw+12)+50;
      int r =i/cols*(ch+12)+30;
      if (card[i]>0 && !faceUp[i]
        && mouseX> c && mouseX< c+cw &&
        mouseY>r && mouseY< r+ch)
      {
        hand[Count]=i;
        Count++;//////
        faceUp[i]=true;
        if (Count==2)
          checkMatch();
      }
    }
  }
}

void checkMatch()
{

  // if same remove
  if (card[hand[0]] == card [hand[1]])//////////////////////////////////CHANGE VALUE
  {
    if (turn==2)
      AIpairs.add(hand[0]);
    /////////////////////////////////////
    card[hand[0]] =-1; 
    card[hand[1]] =-1;
  } else
  {
    faceUp[hand[0]] =false;
    faceUp[hand[1]] =false;
  }

  //else flip back
  Count = 0;
  alarm=-1;
}////

void AITurn()
{
  boolean found = false;
  /// add to mem if hand exists 
  for (int i=0; i<hand.length; i++)
    if ( hand[i]>0 && card[hand [i]] >0)
      mem.add(hand[i]);

  // remove from mem cards that dont exist

  for (int i=0; i<mem.size(); i++)
  {
    println("i "+i+" hand[0] "+hand[0]+" mem.get(i) "+mem.get(i) );
    if (card[mem.get(i)]<0)
    {
      mem.remove(i);
      i--;
    }
  }

  //trip mem limit
  while (mem.size()> maxMem)
  {
    mem.remove(0);
  }
  // 2 cards match in mem

  // pick 1 card random other form memory
  hand[0]= int(random(card.length));
  while (card[hand[0]]<0)
    hand[0] =int(random(card.length));

  for (int i=0; i<mem.size() && !found; i++)////////////found
  {
if ( hand[0] !=mem.get(i) ) {
    println("same "+ card[hand[0]] +" ?==? "+card[mem.get(i)] );
    if ( card[hand[0]] == card[mem.get(i)] ) {
      hand[1]=mem.get(i);
    }
  }
}

  // pick both cards random 
  if (!found)
  {
    hand[1] =int(random(card.length));
    while (card[hand[1]]< 0||hand[0] == hand[1])
      hand[1] =int(random(card.length));
  }
  faceUp[hand[0]] =true;
  faceUp[hand[1]] =true;
 alarm=1;// WAith
  
  if (scene ==0)
  { 
    image(MENU, 0, 0);
  }
}

```

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [December 31, 2019, 4:08am UTC](https://discourse.processing.org/t/hi-i-have-a-error-in-my-code-please-help-project-due-memory-game/16749/2 "2019-12-31T04:08:18Z")

</div>

please format your code posting by pasting it into the

```auto
</> code button

```

of the editor header menu ( context name: Preformatted text )  
it looks like  
```  
type or paste code here  
```

also can use the ``` manually above and below your code.

thank you.

* * *

---

<div class="post-metadata">

**Author:** ![pothead](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@pothead](https://discourse.processing.org/u/pothead)\
**Post date:** [December 31, 2019, 5:17am UTC](https://discourse.processing.org/t/hi-i-have-a-error-in-my-code-please-help-project-due-memory-game/16749/3 "2019-12-31T05:17:24Z")

</div>

sorry dint know thanks

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [December 31, 2019, 5:24am UTC](https://discourse.processing.org/t/hi-i-have-a-error-in-my-code-please-help-project-due-memory-game/16749/4 "2019-12-31T05:24:28Z")

</div>

> [@pothead](#):
>
> having ARRAY OUT OF BOUNDS on my code

In which line number / array?

Please note that you use i -1 as an index in setup. Looks suspicious.

Start for loops at 0

---

<div class="post-metadata">

**Author:** ![pothead](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@pothead](https://discourse.processing.org/u/pothead)\
**Post date:** [December 31, 2019, 5:44am UTC](https://discourse.processing.org/t/hi-i-have-a-error-in-my-code-please-help-project-due-memory-game/16749/5 "2019-12-31T05:44:15Z")

</div>

Oh ok i will look into that  
its on the  
`void showGrid();`  
and its the`cardPic` or lines 107 and 108

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [December 31, 2019, 5:49am UTC](https://discourse.processing.org/t/hi-i-have-a-error-in-my-code-please-help-project-due-memory-game/16749/6 "2019-12-31T05:49:25Z")

</div>

cardPic is also the one in setup

14 images-\> for loop from 0 to \<14

---

<div class="post-metadata">

**Author:** ![pothead](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@pothead](https://discourse.processing.org/u/pothead)\
**Post date:** [December 31, 2019, 6:01am UTC](https://discourse.processing.org/t/hi-i-have-a-error-in-my-code-please-help-project-due-memory-game/16749/7 "2019-12-31T06:01:29Z")

</div>

Yep forgot about that  
thanks but that still gives me array out of bounds exception the change doesn’t affect the function of the code thou

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [December 31, 2019, 6:32am UTC](https://discourse.processing.org/t/hi-i-have-a-error-in-my-code-please-help-project-due-memory-game/16749/8 "2019-12-31T06:32:12Z")

</div>

i worry your remove loop

```auto
  for (int i=0; i<mem.size(); i++)
  {
    if (card[mem.get(i)]<0)
    {
      mem.remove(i);
      i--;
    }
  }

```

see how i play and changed to a FOR loop from max to 0…

```auto
ArrayList mem = new ArrayList();
void setup() {
  mem.add(1);
  mem.add(2);
  mem.add(3);
  mem.add(4);
  mem.add(5);
  println( mem.size() );
  println(mem);
  // now we try remove [1] "2" AND [3] "4"
/*
  for (int i=0; i<mem.size(); i++) {
    if ( i == 1 || i == 3) {
      mem.remove(i);
      i--; //5 [1, 2, 3, 4, 5] [1]
    }
  }
*/
  for (int i=mem.size()-1; i>=0; i--) if ( i == 1 || i == 3 ) mem.remove(i);
  println(mem);
}

```

---

<div class="post-metadata">

**Author:** ![pothead](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@pothead](https://discourse.processing.org/u/pothead)\
**Post date:** [December 31, 2019, 9:08am UTC](https://discourse.processing.org/t/hi-i-have-a-error-in-my-code-please-help-project-due-memory-game/16749/9 "2019-12-31T09:08:09Z")

</div>

> [@kll](#):
>
> // now we try remove [1] “2” AND [3] “4” /\* for (int i=0; i\<mem.size(); i++) { if ( i == 1 || i == 3) { mem.remove(i); i–; //5 [1, 2, 3, 4, 5] [1] } } \*/

I tried that but that gives me another error, sorry i am just a begginner in proccessing and only know one way to do this.

heres where error was

```auto
 for (int i=0; i<mem.size() && !found; i++)////////////found
  {
    if (hand[0] !=mem.get(i) && card[hand[0]] == card[mem.get(i)])
    {
      hand[1]=mem.get(i);
      found=true; /////////////////found
    }
  }

```

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [December 31, 2019, 11:45am UTC](https://discourse.processing.org/t/hi-i-have-a-error-in-my-code-please-help-project-due-memory-game/16749/10 "2019-12-31T11:45:22Z")

</div>

-a- to stop/exit a FOR loop can use

```auto
break;

```

-b- sorry can not follow that logic,  
how about some printing

- inside the loop
- inside the if ?

```auto
for (int i = 0; i < mem.size(); i++) {
  println("i "+i+" hand[0] "+hand[0]+" mem.get(i) "+mem.get(i) );
  if ( hand[0] !=mem.get(i) ) {
    println("same "+ card[hand[0]] +" ?==? "+card[mem.get(i)] );
    if ( card[hand[0]] == card[mem.get(i)] ) {
      hand[1]=mem.get(i);
    }
  }
}
```

---

<div class="post-metadata">

**Author:** ![pothead](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@pothead](https://discourse.processing.org/u/pothead)\
**Post date:** [January 2, 2020, 7:44am UTC](https://discourse.processing.org/t/hi-i-have-a-error-in-my-code-please-help-project-due-memory-game/16749/11 "2020-01-02T07:44:43Z")

</div>

> [@kll](#):
>
> for (int i = 0; i \< mem.size(); i++) { println("i “+i+” hand[0] “+hand[0]+” mem.get(i) "+mem.get(i) ); if ( hand[0] !=mem.get(i) ) { println("same “+ card[hand[0]] +” ?==? "+card[mem.get(i)] ); if ( card[hand[0]] == card[mem.get(i)] ) { hand[1]=mem.get(i); } } }

Here is the console read  
I think changing the for loop is messing with the memory and makes the AI moves really bad  
also i am updating the code as we go, i can also attach the data folder if that makes it easy

```auto
i 3 hand[0] 19 mem.get(i) 20
i 4 hand[0] 19 mem.get(i) 3
i 5 hand[0] 19 mem.get(i) 20
i 6 hand[0] 19 mem.get(i) 19
i 7 hand[0] 19 mem.get(i) 19
i 8 hand[0] 19 mem.get(i) 14
same 1 ?==? 2
same 1 ?==? 6
same 1 ?==? 12
same 1 ?==? 6
same 1 ?==? 9
same 1 ?==? 9
same 1 ?==? 5
i 0 hand[0] 7 mem.get(i) 23
i 1 hand[0] 7 mem.get(i) 20
i 2 hand[0] 7 mem.get(i) 3
i 3 hand[0] 7 mem.get(i) 20
i 4 hand[0] 7 mem.get(i) 19
i 5 hand[0] 7 mem.get(i) 19
i 6 hand[0] 7 mem.get(i) 14
i 7 hand[0] 7 mem.get(i) 7
i 8 hand[0] 7 mem.get(i) 3
same 7 ?==? 12
same 7 ?==? 6
same 7 ?==? 9
same 7 ?==? 9
same 7 ?==? 5
same 7 ?==? 1
same 7 ?==? 12
i 0 hand[0] 11 mem.get(i) 3
i 1 hand[0] 11 mem.get(i) 20
i 2 hand[0] 11 mem.get(i) 19
i 3 hand[0] 11 mem.get(i) 19
i 4 hand[0] 11 mem.get(i) 14
i 5 hand[0] 11 mem.get(i) 7
i 6 hand[0] 11 mem.get(i) 3
i 7 hand[0] 11 mem.get(i) 11
i 8 hand[0] 11 mem.get(i) 8
same 10 ?==? 9
same 10 ?==? 9
same 10 ?==? 5
same 10 ?==? 1
same 10 ?==? 12
same 10 ?==? 7
same 10 ?==? 4
i 0 hand[0] 16 mem.get(i) 19
i 1 hand[0] 16 mem.get(i) 19
i 2 hand[0] 16 mem.get(i) 14
i 3 hand[0] 16 mem.get(i) 7
i 4 hand[0] 16 mem.get(i) 3
i 5 hand[0] 16 mem.get(i) 11
i 6 hand[0] 16 mem.get(i) 8
i 7 hand[0] 16 mem.get(i) 16
i 8 hand[0] 16 mem.get(i) 8
same 9 ?==? 5
same 9 ?==? 1
same 9 ?==? 12
same 9 ?==? 7
same 9 ?==? 4
same 9 ?==? 10
same 9 ?==? 4
i 0 hand[0] 9 mem.get(i) 14
i 1 hand[0] 9 mem.get(i) 7
i 2 hand[0] 9 mem.get(i) 3
i 3 hand[0] 9 mem.get(i) 11
i 4 hand[0] 9 mem.get(i) 8
i 5 hand[0] 9 mem.get(i) 16
i 6 hand[0] 9 mem.get(i) 8
i 7 hand[0] 9 mem.get(i) 9
same 1 ?==? 12
same 1 ?==? 7
same 1 ?==? 4
same 1 ?==? 10
same 1 ?==? 4
same 1 ?==? 9
i 0 hand[0] 7 mem.get(i) 7
i 1 hand[0] 7 mem.get(i) 3
i 2 hand[0] 7 mem.get(i) 11
i 3 hand[0] 7 mem.get(i) 8
i 4 hand[0] 7 mem.get(i) 16
i 5 hand[0] 7 mem.get(i) 8
i 6 hand[0] 7 mem.get(i) 9
i 7 hand[0] 7 mem.get(i) 7
i 8 hand[0] 7 mem.get(i) 20
same 1 ?==? 7
same 1 ?==? 4
same 1 ?==? 10
same 1 ?==? 4
same 1 ?==? 9
same 1 ?==? 1
same 1 ?==? 6
i 0 hand[0] 18 mem.get(i) 11
i 1 hand[0] 18 mem.get(i) 8
i 2 hand[0] 18 mem.get(i) 16
i 3 hand[0] 18 mem.get(i) 8
i 4 hand[0] 18 mem.get(i) 9
i 5 hand[0] 18 mem.get(i) 7
i 6 hand[0] 18 mem.get(i) 20
i 7 hand[0] 18 mem.get(i) 18
i 8 hand[0] 18 mem.get(i) 20
same 10 ?==? 10
same 10 ?==? 4
same 10 ?==? 9
same 10 ?==? 1
same 10 ?==? 6
same 10 ?==? 1
same 10 ?==? 6
i 0 hand[0] 5 mem.get(i) 16
i 1 hand[0] 5 mem.get(i) 8
i 2 hand[0] 5 mem.get(i) 9
i 3 hand[0] 5 mem.get(i) 7
i 4 hand[0] 5 mem.get(i) 20
i 5 hand[0] 5 mem.get(i) 18
i 6 hand[0] 5 mem.get(i) 20
i 7 hand[0] 5 mem.get(i) 5
i 8 hand[0] 5 mem.get(i) 11
same 1 ?==? 9
same 1 ?==? 6
same 1 ?==? 1
same 1 ?==? 6
same 1 ?==? 10
same 1 ?==? 7
i 0 hand[0] 7 mem.get(i) 9
i 1 hand[0] 7 mem.get(i) 7
i 2 hand[0] 7 mem.get(i) 20
i 3 hand[0] 7 mem.get(i) 18
i 4 hand[0] 7 mem.get(i) 20
i 5 hand[0] 7 mem.get(i) 5
i 6 hand[0] 7 mem.get(i) 11
i 7 hand[0] 7 mem.get(i) 7
i 8 hand[0] 7 mem.get(i) 10
same 9 ?==? 6
same 9 ?==? 1
same 9 ?==? 6
same 9 ?==? 10
same 9 ?==? 7
same 9 ?==? 1
same 9 ?==? 6
i 0 hand[0] 19 mem.get(i) 20
i 1 hand[0] 19 mem.get(i) 18
i 2 hand[0] 19 mem.get(i) 20
i 3 hand[0] 19 mem.get(i) 5
i 4 hand[0] 19 mem.get(i) 11
i 5 hand[0] 19 mem.get(i) 7
i 6 hand[0] 19 mem.get(i) 10
i 7 hand[0] 19 mem.get(i) 19
i 8 hand[0] 19 mem.get(i) 8
same 12 ?==? 6
same 12 ?==? 10
same 12 ?==? 7
same 12 ?==? 1
same 12 ?==? 6
same 12 ?==? 9
same 12 ?==? 4
i 0 hand[0] 3 mem.get(i) 20
i 1 hand[0] 3 mem.get(i) 5
i 2 hand[0] 3 mem.get(i) 11
i 3 hand[0] 3 mem.get(i) 7
i 4 hand[0] 3 mem.get(i) 10
i 5 hand[0] 3 mem.get(i) 19
i 6 hand[0] 3 mem.get(i) 8
i 7 hand[0] 3 mem.get(i) 3
i 8 hand[0] 3 mem.get(i) 12
same 7 ?==? 1
same 7 ?==? 6
same 7 ?==? 9
same 7 ?==? 4
same 7 ?==? 12
same 7 ?==? 8
i 0 hand[0] 11 mem.get(i) 11
i 1 hand[0] 11 mem.get(i) 7
i 2 hand[0] 11 mem.get(i) 10
i 3 hand[0] 11 mem.get(i) 19
i 4 hand[0] 11 mem.get(i) 8
i 5 hand[0] 11 mem.get(i) 3
i 6 hand[0] 11 mem.get(i) 12
i 7 hand[0] 11 mem.get(i) 11
i 8 hand[0] 11 mem.get(i) 14
same 3 ?==? 6
same 3 ?==? 9
same 3 ?==? 4
same 3 ?==? 12
same 3 ?==? 8
same 3 ?==? 7
same 3 ?==? 5
i 0 hand[0] 21 mem.get(i) 10
i 1 hand[0] 21 mem.get(i) 19
i 2 hand[0] 21 mem.get(i) 8
i 3 hand[0] 21 mem.get(i) 3
i 4 hand[0] 21 mem.get(i) 12
i 5 hand[0] 21 mem.get(i) 11
i 6 hand[0] 21 mem.get(i) 14
i 7 hand[0] 21 mem.get(i) 21
i 8 hand[0] 21 mem.get(i) 23
same 9 ?==? 4
same 9 ?==? 12
same 9 ?==? 8
same 9 ?==? 7
same 9 ?==? 5
same 9 ?==? 3
same 9 ?==? 2
i 0 hand[0] 19 mem.get(i) 8
i 1 hand[0] 19 mem.get(i) 3
i 2 hand[0] 19 mem.get(i) 12
i 3 hand[0] 19 mem.get(i) 11
i 4 hand[0] 19 mem.get(i) 14
i 5 hand[0] 19 mem.get(i) 21
i 6 hand[0] 19 mem.get(i) 23
i 7 hand[0] 19 mem.get(i) 19
i 8 hand[0] 19 mem.get(i) 6
same 11 ?==? 8
same 11 ?==? 7
same 11 ?==? 5
same 11 ?==? 3
same 11 ?==? 2
same 11 ?==? 9
same 11 ?==? 4
i 0 hand[0] 15 mem.get(i) 12
i 1 hand[0] 15 mem.get(i) 11
i 2 hand[0] 15 mem.get(i) 14
i 3 hand[0] 15 mem.get(i) 21
i 4 hand[0] 15 mem.get(i) 23
i 5 hand[0] 15 mem.get(i) 19
i 6 hand[0] 15 mem.get(i) 6
i 7 hand[0] 15 mem.get(i) 15
i 8 hand[0] 15 mem.get(i) 4
same 3 ?==? 5
same 3 ?==? 2
same 3 ?==? 9
same 3 ?==? 4
same 3 ?==? 11
same 3 ?==? 5
i 0 hand[0] 21 mem.get(i) 14
i 1 hand[0] 21 mem.get(i) 21
i 2 hand[0] 21 mem.get(i) 23
i 3 hand[0] 21 mem.get(i) 19
i 4 hand[0] 21 mem.get(i) 6
i 5 hand[0] 21 mem.get(i) 15
i 6 hand[0] 21 mem.get(i) 4
i 7 hand[0] 21 mem.get(i) 21
i 8 hand[0] 21 mem.get(i) 1
same 6 ?==? 2
same 6 ?==? 9
same 6 ?==? 4
same 6 ?==? 11
same 6 ?==? 5
same 6 ?==? 3
same 6 ?==? 7
i 0 hand[0] 10 mem.get(i) 23
i 1 hand[0] 10 mem.get(i) 19
i 2 hand[0] 10 mem.get(i) 6
i 3 hand[0] 10 mem.get(i) 15
i 4 hand[0] 10 mem.get(i) 4
i 5 hand[0] 10 mem.get(i) 21
i 6 hand[0] 10 mem.get(i) 1
i 7 hand[0] 10 mem.get(i) 10
i 8 hand[0] 10 mem.get(i) 13
same 12 ?==? 4
same 12 ?==? 11
same 12 ?==? 5
same 12 ?==? 3
same 12 ?==? 7
same 12 ?==? 6
same 12 ?==? 2
i 0 hand[0] 3 mem.get(i) 6
i 1 hand[0] 3 mem.get(i) 15
i 2 hand[0] 3 mem.get(i) 4
i 3 hand[0] 3 mem.get(i) 21
i 4 hand[0] 3 mem.get(i) 1
i 5 hand[0] 3 mem.get(i) 10
i 6 hand[0] 3 mem.get(i) 13
i 7 hand[0] 3 mem.get(i) 3
same 11 ?==? 11
same 11 ?==? 5
same 11 ?==? 3
same 11 ?==? 7
same 11 ?==? 6
same 11 ?==? 2
same 11 ?==? 12
i 0 hand[0] 0 mem.get(i) 15
i 1 hand[0] 0 mem.get(i) 4
i 2 hand[0] 0 mem.get(i) 21
i 3 hand[0] 0 mem.get(i) 1
i 4 hand[0] 0 mem.get(i) 10
i 5 hand[0] 0 mem.get(i) 13
i 6 hand[0] 0 mem.get(i) 3
i 7 hand[0] 0 mem.get(i) 23
same 7 ?==? 5
same 7 ?==? 3
same 7 ?==? 6
same 7 ?==? 2
same 7 ?==? 12
same 7 ?==? 2
i 0 hand[0] 1 mem.get(i) 4
i 1 hand[0] 1 mem.get(i) 21
i 2 hand[0] 1 mem.get(i) 1
i 3 hand[0] 1 mem.get(i) 10
i 4 hand[0] 1 mem.get(i) 13
i 5 hand[0] 1 mem.get(i) 3
i 6 hand[0] 1 mem.get(i) 23
i 7 hand[0] 1 mem.get(i) 1
i 8 hand[0] 1 mem.get(i) 13
same 10 ?==? 7
same 10 ?==? 6
same 10 ?==? 2
same 10 ?==? 12
same 10 ?==? 2
same 10 ?==? 7
same 10 ?==? 2
i 0 hand[0] 16 mem.get(i) 1
i 1 hand[0] 16 mem.get(i) 10
i 2 hand[0] 16 mem.get(i) 13
i 3 hand[0] 16 mem.get(i) 3
i 4 hand[0] 16 mem.get(i) 23
i 5 hand[0] 16 mem.get(i) 1
i 6 hand[0] 16 mem.get(i) 13
i 7 hand[0] 16 mem.get(i) 16
i 8 hand[0] 16 mem.get(i) 3
same 1 ?==? 2
same 1 ?==? 12
same 1 ?==? 2
same 1 ?==? 7
same 1 ?==? 2
same 1 ?==? 10
same 1 ?==? 12
i 0 hand[0] 18 mem.get(i) 13
i 1 hand[0] 18 mem.get(i) 3
i 2 hand[0] 18 mem.get(i) 23
i 3 hand[0] 18 mem.get(i) 1
i 4 hand[0] 18 mem.get(i) 13
i 5 hand[0] 18 mem.get(i) 16
i 6 hand[0] 18 mem.get(i) 3
i 7 hand[0] 18 mem.get(i) 18
i 8 hand[0] 18 mem.get(i) 12
same 6 ?==? 2
same 6 ?==? 7
same 6 ?==? 2
same 6 ?==? 10
same 6 ?==? 12
same 6 ?==? 1
same 6 ?==? 8
i 0 hand[0] 10 mem.get(i) 23
i 1 hand[0] 10 mem.get(i) 1
i 2 hand[0] 10 mem.get(i) 13
i 3 hand[0] 10 mem.get(i) 16
i 4 hand[0] 10 mem.get(i) 3
i 5 hand[0] 10 mem.get(i) 18
i 6 hand[0] 10 mem.get(i) 12
i 7 hand[0] 10 mem.get(i) 10
i 8 hand[0] 10 mem.get(i) 13
same 4 ?==? 2
same 4 ?==? 10
same 4 ?==? 12
same 4 ?==? 1
same 4 ?==? 8
same 4 ?==? 6
same 4 ?==? 2
i 0 hand[0] 8 mem.get(i) 13
i 1 hand[0] 8 mem.get(i) 16
i 2 hand[0] 8 mem.get(i) 3
i 3 hand[0] 8 mem.get(i) 18
i 4 hand[0] 8 mem.get(i) 12
i 5 hand[0] 8 mem.get(i) 10
i 6 hand[0] 8 mem.get(i) 13
i 7 hand[0] 8 mem.get(i) 8
i 8 hand[0] 8 mem.get(i) 3
same 4 ?==? 12
same 4 ?==? 1
same 4 ?==? 8
same 4 ?==? 6
same 4 ?==? 2
same 4 ?==? 4
same 4 ?==? 12
i 0 hand[0] 6 mem.get(i) 3
i 1 hand[0] 6 mem.get(i) 18
i 2 hand[0] 6 mem.get(i) 12
i 3 hand[0] 6 mem.get(i) 10
i 4 hand[0] 6 mem.get(i) 13
i 5 hand[0] 6 mem.get(i) 8
i 6 hand[0] 6 mem.get(i) 3
i 7 hand[0] 6 mem.get(i) 6
i 8 hand[0] 6 mem.get(i) 10
same 7 ?==? 8
same 7 ?==? 6
same 7 ?==? 2
same 7 ?==? 4
same 7 ?==? 12
same 7 ?==? 4
same 7 ?==? 6
i 0 hand[0] 11 mem.get(i) 12
i 1 hand[0] 11 mem.get(i) 10
i 2 hand[0] 11 mem.get(i) 13
i 3 hand[0] 11 mem.get(i) 8
i 4 hand[0] 11 mem.get(i) 3
i 5 hand[0] 11 mem.get(i) 6
i 6 hand[0] 11 mem.get(i) 10
i 7 hand[0] 11 mem.get(i) 11
i 8 hand[0] 11 mem.get(i) 3
same 7 ?==? 2
same 7 ?==? 4
same 7 ?==? 12
same 7 ?==? 4
same 7 ?==? 6
same 7 ?==? 12
i 0 hand[0] 11 mem.get(i) 13
i 1 hand[0] 11 mem.get(i) 8
i 2 hand[0] 11 mem.get(i) 3
i 3 hand[0] 11 mem.get(i) 6
i 4 hand[0] 11 mem.get(i) 10
i 5 hand[0] 11 mem.get(i) 11
i 6 hand[0] 11 mem.get(i) 3
i 7 hand[0] 11 mem.get(i) 11
i 8 hand[0] 11 mem.get(i) 14
same 8 ?==? 12
same 8 ?==? 4
same 8 ?==? 6
same 8 ?==? 7
same 8 ?==? 12
same 8 ?==? 7
same 8 ?==? 5
i 0 hand[0] 12 mem.get(i) 3
i 1 hand[0] 12 mem.get(i) 6
i 2 hand[0] 12 mem.get(i) 10
i 3 hand[0] 12 mem.get(i) 11
i 4 hand[0] 12 mem.get(i) 3
i 5 hand[0] 12 mem.get(i) 11
i 6 hand[0] 12 mem.get(i) 14
i 7 hand[0] 12 mem.get(i) 12
i 8 hand[0] 12 mem.get(i) 9
same 8 ?==? 6
same 8 ?==? 7
same 8 ?==? 12
same 8 ?==? 7
same 8 ?==? 5
same 8 ?==? 9
i 0 hand[0] 12 mem.get(i) 10
i 1 hand[0] 12 mem.get(i) 11
i 2 hand[0] 12 mem.get(i) 3
i 3 hand[0] 12 mem.get(i) 11
i 4 hand[0] 12 mem.get(i) 14
i 5 hand[0] 12 mem.get(i) 12
i 6 hand[0] 12 mem.get(i) 9
i 7 hand[0] 12 mem.get(i) 12
i 8 hand[0] 12 mem.get(i) 15
same 10 ?==? 12
same 10 ?==? 7
same 10 ?==? 5
same 10 ?==? 8
same 10 ?==? 9
same 10 ?==? 8
same 10 ?==? 11
i 0 hand[0] 16 mem.get(i) 3
i 1 hand[0] 16 mem.get(i) 11
i 2 hand[0] 16 mem.get(i) 14
i 3 hand[0] 16 mem.get(i) 12
i 4 hand[0] 16 mem.get(i) 9
i 5 hand[0] 16 mem.get(i) 12
i 6 hand[0] 16 mem.get(i) 15
i 7 hand[0] 16 mem.get(i) 16
i 8 hand[0] 16 mem.get(i) 22
same 10 ?==? 5
same 10 ?==? 8
same 10 ?==? 9
same 10 ?==? 8
same 10 ?==? 11
same 10 ?==? 10
same 10 ?==? 8
i 0 hand[0] 5 mem.get(i) 14
i 1 hand[0] 5 mem.get(i) 12
i 2 hand[0] 5 mem.get(i) 9
i 3 hand[0] 5 mem.get(i) 12
i 4 hand[0] 5 mem.get(i) 15
i 5 hand[0] 5 mem.get(i) 16
i 6 hand[0] 5 mem.get(i) 22
i 7 hand[0] 5 mem.get(i) 5
i 8 hand[0] 5 mem.get(i) 2
same 5 ?==? 9
same 5 ?==? 8
same 5 ?==? 11
same 5 ?==? 10
same 5 ?==? 8
same 5 ?==? 10
same 5 ?==? 3
i 0 hand[0] 14 mem.get(i) 9
i 1 hand[0] 14 mem.get(i) 12
i 2 hand[0] 14 mem.get(i) 15
i 3 hand[0] 14 mem.get(i) 16
i 4 hand[0] 14 mem.get(i) 22
i 5 hand[0] 14 mem.get(i) 5
i 6 hand[0] 14 mem.get(i) 2
same 11 ?==? 9
same 11 ?==? 8
same 11 ?==? 11
same 11 ?==? 10
same 11 ?==? 8
same 11 ?==? 10
same 11 ?==? 3
ArrayIndexOutOfBoundsException: 14
```
