Problem 753. Solitaire Cipher
I believe there is an error in test case 2. the first value should be 1, not 3.
The process appears correct thru step 3 yielding [28 2 3...26 27 1]. The triple cut I claim results in [1 28 2 3...26 27]. The solution appears to generate [28 2 3...26 27 1] for the triple cut, which I believe is errant. The step 5 result I believe should be [1 28 2...26 27], no change from the prior step. The Solution's step 5 creates [2 3...26 27 28 1]. My first value thus becomes a 1 and the solution's answer is a 3.
The wiki words actually don't match the numerical exmaple result but that is a different issue.
I see the difference in our code:
d=[28 d(2:26) d(28) d(1)];
proper implementation would be:
if j2 == 27
d = [d(1) 28 d(2:26) d(28)];
Basically, it has to skip two cards down the deck. I will clean up the wording, as I have seen several do this on internal implementations here too.
problem just solved , I can now go on week-end! good luck for other players !
The updated wiki page does not include the full step 6 rule which skips keystream code value for jokers and also does not point to the correct keystream value. The correct value is d(1+d(1)), not d(d(1)). I assert the 1:28 n=10 should produce [4 23 10 28 24 8 17 6 17 27] and the modulo 3 sequence should produce [11 9 23 7 10 25 11 11 7 27].
Being Wikipedia, I just copied the algorithm this test suite was built on. Thanks!
Cody is telling me that in order to see the smaller sized solutions (which is most of them!) I need to answer another problem in the challenge. I've already answered them all. Any ideas on how to see the better solutions?
Any problem will work not just ones in this category.
It's still not working properly. I sent you an e-mail to continue the discussion.
Guys, this is unserious: the few first leading solutions are just an answer table that works solely due to the small number of testing cases! I strongly believe it is bad practice, lazy conduct and violates the spirit of the Cody Challenge; moreover, there _are_ solutions that do not rely on such improper methods (such as mine, which is actually _shorter_ than all of the listed above).
@Doug_Hull, is it not possible to write additional test cases in order to render those methods useless?
I agree entirely. Unfortunately, every time on other problems that I changed the test suite, the look up tables just came back anyways. We need to eventually randomize test suites. When that is supported well, I will do it!
Made a quick change. This should cause a lot of old solutions to fail. Will process the queue as fast as possible! Thanks!
In the tests, the first deck is commented out, so the test doesn't work.
The text above is a little vague on exactly how one treats the jokers when passing across over the bottom of the edge. Specifically, they do behave differently there than at other positions so saying that the deck is a "loop" is not perfectly correct. The following comment in Scheiers original text helped me figure out how I needed to implement that special case: "If the joker is the last card, think of it as the first card before you start counting."
In the description you state "two jokers which are distinguishable from each", but in the steps you make a distinction between joker 27 and 28.
This one has the longest solution I have submitted for the ASEE challenge
You should have an example that deals with the jokers at the bottom, the problem statement does not clearly explain the operation.
The Test Suite has been malfunctioning for some users since January 2018 (or earlier). Please fix the Test Suite. —DIV
Explanation is a bit sparse, just as well there is lots of examples on the net showing worked swaps.
May be some Problem with Test Cases. Even though I assigned given solution value to Output, it doesn't take it and Shows some Default Output.
Update: Test suite still malfunctioning
Rule 6 is still not correct. It should be key = deck(1 + min(27, deck(1))) and not key = deck(deck(1)). In this incorrect version the probability of finding a key of value 1 for a random deck is twice that of other values (1/28 chance that the first value is 1, plus 27/28 x 1/27 chance that the first value is not 1 but points to a 1)
I'm not sure why some users are experiencing problems here, but Doug did provide a reference solution for this problem, and it still passes the test suite as it stands.
I'm not sure where I'm going wrong. If I run the case with 1:28, and after moving the first two jokers I get:
1 28 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 2
After doing a triple cut and exchange
2 28 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 1
Using the value of the bottom card, I inset 1 card form the top to just above the bottom card, I get
28 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 2 1
Now I count 28 places into the deck to get 1 as the keystream value. However, in the test solution, the first key stream value is 3. I'm not sure where I'm going wrong.
#1 doesn't look like it will work, since the assignment of "deck" is commented out.
@Richard Ferrara: what you noticed is a cosmetic problem. While that line appeared commented out, it was still being included. By any means, I've fixed the test suite so that it should not appear commented out now.
Solution CommentsShow comments
Problem Recent Solvers245
Is this is a Tic Tac Toe X Win?
More from this Author51
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!