I think this is a very interesting proposal.
So this kind of tricks still allowed in Cody, but they will be counted in a fair way.
I used this a couple of times, and i think it is useful to learn this kind of coding methods, but it is not the real meaning of Cody.
The most trick I used is the "str2num" one. To count all the numbers inside is a little bit hard, but I will accept this method also. It's fair! ;-)
I believe you need to redefine the 'newline' variable in all of your testsuite cases?
this is a very hard problem to solve in general. For example consider the following cases (the score in the first three cases should be penalized with additional 4 points, while in the latter three cases it should not): 1) regexp('',strcat('(?','@a=1)')); 2) str='(?@a=1)';regexp('',str); 3) regexp(' ',char(')@Ab>2*'-1)); 4) regexp('',strcat('(?','a=1)')); 5) str='(?@a=1)';regexp(str,''); 6) regexp(' ',char(')@Ab>2*'+1));
Alfonso, thank you for your excellent thinking on this subject. You're quite right that an approach based only on parsing the program text would be hard to perfect. One could at least make people work harder to get around the scoring system! But what do you think of a different approach: modifying the definitions of regexp and its ilk on the Cody machines so that they dynamically alter the score when called with eval-like arguments?
Hi Nicholas, that is a very good idea, the main problem would be to solve the correspondence between the different times regexp is called and the different times it might appear in the code, but perhaps using dbstack we could resolve this? (of course we could just penalize for each time it is called even if that might produce very high penalties for loops, etc.) thoughts?
The same regexp expression could potentially be called more than once with different dynamic code each time. It might be best to count the score of each unique code string from each separate invocation point -- that seems most in keeping with the spirit of the current rules. You're right that it would be quite complex to keep track.
Thanks for pointing out the problem with newline, by the way. I think it is fixed now.
I believe this solution misses the point! ;-)
Counting in Finnish
Check to see if a Sudoku Puzzle is Solved
Back to basics 17 - white space
Generate N equally spaced intervals between -L and L
Volume difference between Ellipsoid and Sphere
Reference Index Number
Key Generation for Solitaire Cipher
Find the treasures in MATLAB Central and discover how the community can help you!
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