0

Ok its been awhile since I've taken a CS class and I am still a bit rusty. It seems like a simple problem but I just cant get my brain around it. The program needs to shake a boggle board. For those of you who have never played this game, it is a 4x4 grid that dice with letters fall into.

I created a [16][6] array to store the face values of the dice. The 16 is for the actual number of dice and the 6 is for the different sides of the dice.

The program is to swap 2 random dice and then randomize which side of the dice is showing.

I created an array with a length of 16 and then stored the first side values in them. From here I can randomize which side of any dice is showing but I have still not figured out how to swap the dice position without losing the data for the different sides of the dice.

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by rkulp
1

Set up another array of 16 (say ptr ) with values from 0-15, randomize that array. Then you access the dice array:

r = random value (0-15)
dice[ptr[r]][x]
Votes + Comments
Thanks for the help, it was exactly what I needed to know.
0

Ya its the same program but it isn't the same problem.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.