Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Alice and Bob
#1
Alice and Bob are magicians. Alice asks a volunteer to randomly draw five playing cards from a deck. She takes the cards from the volunteer and looks at them without revealing them to anyone else. Alice then begins showing them to Bob one at a time. After the fourth card, Bob correctly guesses what the fifth card is. The secret to this trick was to come up with an algorithm that when given any five cards, could order four of them so that the fifth could be guessed by this order. (See where this is going yet?)

The challenge is for you to come up with said algorithm and implement it in QB or FB. Your program should describe the algorithm to the user, give him five random cards, ask for four cards back and then return the fifth. In other words, the user will be Alice and the program will be the audience member and Bob. (You just have to make sure that Bob is a separate function or that would be cheating.) There are many possible solutions, most of which are surprisingly simple.

Rules:

1) Don't post your code here! Put it in a folder along with a compiled (.exe) version of your file and fileanchor it. You can post a link to it here. This will prevent people that want to solve this themselves from having to see the answer.

2) There will be no time limit on this challenge.

3) The winner will be the first person to come up with a working program that correctly guesses the fifth card every time. However, even if there is already a winner I encourage you to still participate. I would love to see different solutions to this.

4) If you haven't found a solution, don't peek at the others. This is really for your benefit. It's much more satisfying to find a solution yourself than to just read it.

5) If after a week no one has solved this, you can PM me for a hint. After another week, you can PM again for another hint. But like I said, it's much more rewarding to solve this on your own.

6) There won't be a prize for this because, well, I don't have anything :lol: I guess a hearty pat on the back from me will have to do. And of course all the fame and recognition you get from winning a Qbasicnews challenge!

7) Finally, this isn't my homework assignment so don't harass me with accusations. I have a solution of my own already.


If you have a question about this challenge or need something explained better just post it here. I tried to explain it as plainly as possible but I know it can still sound confusing. Hopefully someone will be able to put it in simpler terms.

Ok. Have fun!
hat were we arguing about again?
Reply


Messages In This Thread
Alice and Bob - by DefHo - 01-01-2006, 01:52 AM
Alice and Bob - by Andrew Collins - 01-01-2006, 01:56 AM
Alice and Bob - by DefHo - 01-01-2006, 02:29 AM
Alice and Bob - by Deleter - 01-01-2006, 04:50 AM
Alice and Bob - by Sterling Christensen - 01-01-2006, 05:52 AM
Alice and Bob - by Agamemnus - 01-01-2006, 11:14 AM
Alice and Bob - by DefHo - 01-02-2006, 04:43 AM
Alice and Bob - by Agamemnus - 01-02-2006, 07:20 AM
Alice and Bob - by Sterling Christensen - 01-02-2006, 09:15 AM
Alice and Bob - by DefHo - 01-02-2006, 08:52 PM
Alice and Bob - by Agamemnus - 01-03-2006, 02:12 AM
Alice and Bob - by Sterling Christensen - 01-03-2006, 04:19 PM
Alice and Bob - by Agamemnus - 01-04-2006, 11:05 AM
Alice and Bob - by vspickelen - 01-04-2006, 06:08 PM
Alice and Bob - by Sterling Christensen - 01-05-2006, 03:20 AM
Alice and Bob - by DefHo - 01-05-2006, 05:21 AM
Alice and Bob - by vspickelen - 01-05-2006, 10:42 PM
Alice and Bob - by Agamemnus - 01-06-2006, 09:20 AM
Alice and Bob - by vspickelen - 01-10-2006, 09:41 PM
Alice and Bob - by DefHo - 01-11-2006, 10:39 AM
Alice and Bob - by vspickelen - 01-13-2006, 03:07 PM
Alice and Bob - by DefHo - 01-14-2006, 01:33 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)