Jump to content

Recommended Posts

I've been struggling with this over the past few days and I can't seem to come up with the solution for what I'm trying to create.

 

Suppose you have a bike combination lock with three wheels on it (one of those twist ones where there are 3 wheels, each side by side with numbers printed on each wheel). The wheels go between 0 and 15. Now suppose you have a random number generator that generates a set of 3 numbers, one for each wheel on the bike lock, and each random number generated is also between 0 and 15. And finally, suppose that the correct combination to unlock is defined by each wheel, so if the correct combination is 3,3,3 then it is $w1 = 3; $w2 = 3; $w3 = 3;, and the correct combination can be unlocked even if the wheels are offset by a total of 3. Meaning if $wh1 and $wh2 was equal to 3, and $wh3 was equal to 6 then it will still unlock. Or if $wh1, $wh2, and $wh3 all equaled 4, then that is still correct because the total offset of all 3 wheels combined is still 3.

 

With each new random number set generated for the 3 bike lock wheels, what is the most appropriate and efficient way to check and see if the random number generated each time is the one defined as the correct combination?

 

I've been struggling with this over the past few days and I can't seem to come up with the solution for what I'm trying to create.

 

Suppose you have a bike combination lock with three wheels on it (one of those twist ones where there are 3 wheels, each side by side with numbers printed on each wheel). The wheels go between 0 and 15. Now suppose you have a random number generator that generates a set of 3 numbers, one for each wheel on the bike lock, and each random number generated is also between 0 and 15. And finally, suppose that the correct combination to unlock is defined by each wheel, so if the correct combination is 3,3,3 then it is $w1 = 3; $w2 = 3; $w3 = 3;, and the correct combination can be unlocked even if the wheels are offset by a total of 3. Meaning if $wh1 and $wh2 was equal to 3, and $wh3 was equal to 6 then it will still unlock. Or if $wh1, $wh2, and $wh3 all equaled 4, then that is still correct because the total offset of all 3 wheels combined is still 3.

 

With each new random number set generated for the 3 bike lock wheels, what is the most appropriate and efficient way to check and see if the random number generated each time is the one defined as the correct combination?

 

I hope your not hacking with this. I have tried making one of these in the past... It failed. Maybe you should try javascript...?

I've been struggling with this over the past few days and I can't seem to come up with the solution for what I'm trying to create.

 

Suppose you have a bike combination lock with three wheels on it (one of those twist ones where there are 3 wheels, each side by side with numbers printed on each wheel). The wheels go between 0 and 15. Now suppose you have a random number generator that generates a set of 3 numbers, one for each wheel on the bike lock, and each random number generated is also between 0 and 15. And finally, suppose that the correct combination to unlock is defined by each wheel, so if the correct combination is 3,3,3 then it is $w1 = 3; $w2 = 3; $w3 = 3;, and the correct combination can be unlocked even if the wheels are offset by a total of 3. Meaning if $wh1 and $wh2 was equal to 3, and $wh3 was equal to 6 then it will still unlock. Or if $wh1, $wh2, and $wh3 all equaled 4, then that is still correct because the total offset of all 3 wheels combined is still 3.

 

With each new random number set generated for the 3 bike lock wheels, what is the most appropriate and efficient way to check and see if the random number generated each time is the one defined as the correct combination?

 

I hope your not hacking with this. I have tried making one of these in the past... It failed. Maybe you should try javascript...?

 

No it is nothing to do with hacking, to be honest it is actually part of a game. It doesn't have anything to do with wheels and bike locks. That was just the best I could do at giving a good example of what I'm trying to do without explaining the entire project. I would use javascript but I am not so good with it, I'm trying hard in PHP right now lol. Even if doing this in PHP is not as efficient, that's a sacrifice I'm willing to make to keep this only in PHP right now.

The easiest way would be to create 3 nested loops starting at 0 to 15, populating you 3 variables, then process them in the final loop - how are you going to check that the number is correct (as storing the 3 pin number your trying to find in php, defeats the object).

 

Creating the nested loops (and the offsets) isn't too much work - problem will be verifying that the number is correct

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.