J
JohnIe
Hi.
I'm trying to program a kind of "slot machine". And I've run into a
problem I can't figure out a proper solution to.
To check if there's a winning line in my slot machine, I need to
compare the lines of int's to check if they're similar.
If the table had three rows and three columns, that would be easy
enogh, writing 5 "if"-sentences, but it's going to be up to the user to
choose the number of rows. (rows=columns)
Example:
My "generate random numbers and print assign them to an table"-loop
outputs the following:
3 - 1 - 5
3 - 3 - 3
2 - 4 - 3
How can I get the program to react to the second line and the diagonal
line that contains similar numbers in a way that works for all numbers
of rows (1<rows=columns<10)
Hope someone can help me..
John I
I'm trying to program a kind of "slot machine". And I've run into a
problem I can't figure out a proper solution to.
To check if there's a winning line in my slot machine, I need to
compare the lines of int's to check if they're similar.
If the table had three rows and three columns, that would be easy
enogh, writing 5 "if"-sentences, but it's going to be up to the user to
choose the number of rows. (rows=columns)
Example:
My "generate random numbers and print assign them to an table"-loop
outputs the following:
3 - 1 - 5
3 - 3 - 3
2 - 4 - 3
How can I get the program to react to the second line and the diagonal
line that contains similar numbers in a way that works for all numbers
of rows (1<rows=columns<10)
Hope someone can help me..
John I