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)
Sorry,I want to see the correct answer
Hello. There is still a 'fatal' bug in Cody or the Test Suite which is causing the Test Suite to malfunction and provide incorrect input arguments, as shown in the echoed content of input-variable "deck" below. This problem has persisted for about one month. Please advise.
There is a serious bug.
Variable "deck" is incorrectly being submitted as
[ 1 4 7 10 13 16 19 22 25 28 3 6 9 12 15 18 21 24 27 2 5 8 11 14 17 20 23 26 ] in input to EVERY test in the Test Suite.
Looks like the same Cody bug as I got with Solutions 1465514, 1482458, and 1532793 (March–May 2018). —DIV
Looks like the same Cody bug as I got with Solutions 1465514, 1482458, and 1532803 (March–May 2018). —DIV
Test Suite faulty in January 2018.
Sorry for resubmitting an old regexp solution. Seems, that previous one disappeared. I have to solve this problem the proper way.
I think that this solution is perfectly legitimate. Why try to solve it "properly"? It's not like you are using eval or something like that. regexprep is a perfectly legitimate tool to use.
I agree with your point of view. Regexprep is a powerful function here.
Unfortunately I've used also '(??@some_code)'. In this case, it's not as bad as playing 'size=11' solution, but it is still a kind of size-cheating for me. I used to play solutions like that, but now I try to avoid this.
At the time of submission, all better scores use either a lookup table or regexp.
Whoops! forgot to add in semicolons to supress 'debugging' output.
Triangle Numbers Below N
Sum of diagonal of a square matrix
Output any real number that is neither positive nor negative
Side of an equilateral triangle
Project Euler: Problem 4, Palindromic numbers
Project Euler: Problem 2, Sum of even Fibonacci
Poker Series 01: isStraightFlush
Make blocks of color
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office