Permutations & Combinations Help

It is a combinations code. basically the program has to calculate the right combination based on what is inputted by the user. It is to be used in conjunction with a program written by my professor to guess the correct combination based on information given after each attempt. there are 7 attempts to guess the right combination before the combination resets and you have to start again with a fresh 7 attempts.

There are 4 "vessels" in which 3 variables or "items" can be present in 1 vessel at a time. There are only 7 attempts to calculate the right combination.

There are a total of 81 possibilities ( 4 vessels in which one of 3 can fit in 1 vessel at a time, thus 3*3*3*3 = 81)

In attempt one, you will start with a default combination: ill draw it out here:
Legend: _ (underscore = vessel) & A,B,C = variables

In attempt one:

A A
_ _


B B
_ _


This configuration will be marked as "Attempt 1". The program created by my professor will tell me 3 pieces of information:
1) how many are right
2) how many are wrong
3) how many are unknown

Based on this information, i will input the # right, #wrong, #unknown into my program and it will tell me a new configuration to put as "Attempt 2". It should also display how many possibilities remain after the information provided by my professor is inputted and the new attempt is calculated.

For example, say my program tells me to put this configuration:

B C
_ _

A B
_ _

i will put the configuration above in the spoiler into my professors program and that program will tell me the number right, wrong and unknown. i input the information given into my program and it will tell me the next configuration and output the number of possibilities left until the right configuration .

Each attempt should be based off the all previous attempts' information. This program should keep iterating the steps above (limit up to 7 attempts) until it outputs the right combination to complete my professor's program.


Someone please help me with this! because i have a weak knowledge in combinations and i need some help figuring out how to code this. if you need more info, please let me know.

Thank you in advance for your time and effort in helping me.
Last edited on
You need to show us your code - we will not do your homework for you.
its not really homework, its more like instead of sitting at class guessing away, i could use a program to minimize time . i have no idea how to go about writing this program. any suggestions?
The program created by my professor will tell me 3 pieces of information:


Not really homework?
its really not, this is just an exercise in class for us to understand how powerful combination programs can be. writing a program for it is not required at all. I just want an idea of how to go about writing this program. The only problems i am having are creating the "vessels" and programming how to take previous information and use it in current calculation.
Topic archived. No new replies allowed.