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.

Recommended Answers

All 3 Replies

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]
commented: Thanks for the help, it was exactly what I needed to know. +1

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.