Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C 

Formula for permutation / combination?

Looking for the formula to recursively check for combinations of a mastermind program.

Example:

6 colors
4 peg slots

Guess 1: 0 1 2 3 | No correct slots, 2 correct colors
Guess 2: 2 2 4 1 | No correct slots, 2 correct colors
Guess 3: 4 3 3 2 | 1 correct slot, 1 correct color
Guess 4: 1 3 5 4 | 1 correct slot, 3 correct colors

The answer to this should be 1 possible combination with the partially played game.

Thanks
I don't get it, it's a sort of bruteforce in recursive but what for? What's the purpose?
Its for the mastermind game.

Where you try to pick the correct colors in the correct position. Going by data given I need to compute how many possible combinations are left.
(Oct 2, 2015 12:58 PM).Bux Wrote:  I don't get it, it's a sort of bruteforce in recursive but what for? What's the purpose?

Purpose is simple, learning and moving forward with the game :)
OP have you tried searching it before posting for help?
Let me help you mate http://www.cplusplus.com/forum/general/115298/
Let us know if you have any problem. Spoon feeding is strictly prohibited. Try stuff for yourself and then ask for help instead of doing what you just did.
Regards
I +3 rep4rep <3
For website hacking, custom malware, private RAT source code, dumps etc contact me on TG: @yealink2
(Oct 2, 2015 01:40 PM)stdio Wrote:  Purpose is simple, learning and moving forward with the game :)
OP have you tried searching it before posting for help?
Let me help you mate ....
Let us know if you have any problem. Spoon feeding is strictly prohibited. Try stuff for yourself and then ask for help instead of doing what you just did.
Regards
Thanks Sir. I have been trying to figure it out on paper for the past few hours. I know that there are smart people here so I figured I'd ask. 😵
You would have to of taken Discrete Mathematics 2 in college in order to fully understand combinations and permutations and their respective formulas. However for your case, I'm not sure you actually need one of these formulas.
Regardless, I have not worked with this type of situation before, so I would not know how you would incorporate the formulas.. But here they are.

Combination Formula: nCr = n! / r! (n-r)!

Permutation Formula: nPr = n! / (n-r)!

I do not believe that this is spoon feeding, however if it is.. sorry.

Good Luck!

Source: Discrete Mathematics II student at Texas State University


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by DNAAug 7, 2019 01:12 PM 11 476 Aug 7, 2019 01:12 PM
Last Post: DNA
[C] by hansbaldMay 6, 2018 04:26 AM 0 390 May 6, 2018 04:26 AM
Last Post: hansbald
[Python] by The PactJul 13, 2017 04:35 PM 3 152 Jul 13, 2017 04:35 PM
Last Post: Goodies