# Number Tile Game

**URL:** <https://discourse.processing.org/t/number-tile-game/8342>\
**Category:** Coding Questions\
**Created:** [February 13, 2019, 3:56am UTC](https://discourse.processing.org/t/number-tile-game/8342 "2019-02-13T03:56:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![o0804337](https://avatars.discourse-cdn.com/v4/letter/o/e47c2d/32.png) [@o0804337](https://discourse.processing.org/u/o0804337)\
**Post date:** [February 13, 2019, 3:56am UTC](https://discourse.processing.org/t/number-tile-game/8342/1 "2019-02-13T03:56:30Z")

</div>

`I am trying to make a tile game where you are supposed to put the numbers in order. So I couldn’t get the numbers into the last row and I trying to get them to move. There isn’t supposed to be a square on the bottom right corner so you and shift the squares(numbers).

```auto
int value=0;

int abc = 0;

int cols = 4;

int rows = 4;

int[][] myArray = new int[cols][rows];

 

void setup() {

  size(400, 400);

  background(255, 0, 0);

  for (int i = 0; i &lt; cols; i++) {

    for (int j = 0; j &lt; rows; j++) {

      myArray[i][j] = abc++;

    }

  }

}

 

void draw() 

{

  for (int i = 0; i &lt; cols; i++) 

  {

    for (int j = 0; j &lt; rows; j++) 

    {

      fill(255);

      rect(100*i, 100*j, 100, 100);

      fill(0);

      text(myArray[i][j], 100*i+20, 100*j-30);

    }

  }

}

 

void mouseReleased() {

 

}

```

![5](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/4/4c0936b63b66c7fc391bc4b1ce1948a467b4d641.png)

---

<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:** [February 13, 2019, 4:18am UTC](https://discourse.processing.org/t/number-tile-game/8342/2 "2019-02-13T04:18:08Z")

</div>

you posted your code as  
some text what messed it up… like `&lt;`  
pls post it again using the  
code formatter

```auto
</>

```

so we can copy and paste and run it here.  
also a screen shot can help to understand the problem?

---

<div class="post-metadata">

**Author:** ![o0804337](https://avatars.discourse-cdn.com/v4/letter/o/e47c2d/32.png) [@o0804337](https://discourse.processing.org/u/o0804337)\
**Post date:** [February 13, 2019, 4:29am UTC](https://discourse.processing.org/t/number-tile-game/8342/3 "2019-02-13T04:29:15Z")

</div>

Srry about that. Here you go.

---

<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:** [February 13, 2019, 4:44am UTC](https://discourse.processing.org/t/number-tile-game/8342/4 "2019-02-13T04:44:37Z")

</div>

thanks, but your code is still damaged,  
why you not try what we are supposed to do with it:

> copy, paste in a new processing window and press run

* * *

but i think i found the problem:

```auto
      text(myArray[i][j], 100*i+20, 100*j+30); // not -

```

---

<div class="post-metadata">

**Author:** ![o0804337](https://avatars.discourse-cdn.com/v4/letter/o/e47c2d/32.png) [@o0804337](https://discourse.processing.org/u/o0804337)\
**Post date:** [February 13, 2019, 4:48am UTC](https://discourse.processing.org/t/number-tile-game/8342/5 "2019-02-13T04:48:10Z")

</div>

I already put it into processing and it works normally. But can you explain why it is the problem? I am not very good with arrays.

---

<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:** [February 13, 2019, 5:09am UTC](https://discourse.processing.org/t/number-tile-game/8342/6 "2019-02-13T05:09:12Z")

</div>

> [@o0804337](#):
>
> I am not very good with arrays.

that was not a array problem ( that one is good ), but  
when j == 0  
you draw the text at -30 ( above canvas )  
so you could have noticed that the numbers not start with “0”  
( like first line missing // and not the last )

so…  
your above first code still not run-able,  
and you also not posted the new corrected code down here.
