# Thread: Slots Simulator. Identity Matrix.

1. ## Slots Simulator. Identity Matrix.

Hi, just looking for other peoples ideas on how they would go about solving this problem Right now i genrate a 3x3 int array each with random numbers. I have preset "win condition" matrices spelled out such as:

1 0 0
0 1 0
0 0 1

Here would be a win matrix for a diagonal win. How would you go about comparing a matrix such as

7 5 3
2 7 2
1 9 7

to the win matrix to check for a win?

2. The problem here is that comparing the matrix given to the "win" matrix doesn't reveal any numbers in common, so why you think that's the right thing to do escapes me.

If this is traditional slots in that you'll have only one "1" per column, then you actually want to store just which row is the "1" in. So the slot you have would have win[0]=0, win[1]=1, and win[2] = 2; then you can check that slots[0][win[0]]==slots[1][win[1]] and that slots[0][win[0]]==slots[2][win[2]]. And if you have a bunch of different patters, you might have a larger win array (so maybe win[0][0]=win[0][1]=win[0][2] = 1, for the center row).