Christian Schröder

Cody: what are the criteria for being able to view all solutions?

Christian Schröder on 8 Jan 2023
Latest activity Reply by Arunika on 30 Jan 2023

When solving problems over on Cody, I can almost always view all solutions to a problem after submitting a correct solution of my own. Very rarely, however, this is not the case, and I instead get the following message:
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.
You may solve another problem from Community group to unlock all the solutions to this problem.
If this happens, then again, I can almost always rectify this by submitting a (correct) solution to a different problem (I take it that the Community group is the implicit group of all problems on Cody --- is it?). But sometimes that, too, fails.
So my question is, why? What are the criteria that determine when all solutions are, in fact, unlocked?
(There is a related question here, but I feel the posted answer does not answer the question.)
Arunika on 30 Jan 2023
Updating this thread with some relevant info.
The criteria to view all solutions to a problem in Cody has been updated - now, you have to solve the problem once, and that is all that's needed to view all solutions to that problem.
Arunika on 9 Jan 2023
Hi Christian, thanks for taking the time to post this question.
In the Cody 'About' page, right-hand panel, the rules for unlocking solutions says the following:
Unlocking Solutions
Cody calculates a size for each solution. When you submit a correct solution to a problem, you can see other solutions of the same size (that is, the same length or longer), but not shorter solutions.
Each time you solve a new problem, you unlock all solutions to your previously solved problems in the same group.
You're right in your observation that the 'Community Group' is the implicit group that any problem belongs to, if it hasn't been added to any other groups. So I believe that the behavior you are observing might be that, whenever you solve another ungrouped problem, it is unlocking solutions to other ungrouped problems belonging to Community Group.
I agree this current way could be improved to be more straight-forward and transparent. We are planning to bring some changes into the rules of locking/unlocking solutions for players across Cody, and those changes will definitely be more transparent and streamlined than right now.
Dyuman Joshi
Dyuman Joshi on 11 Jan 2023
For someone who has been active on Cody and Answers (more active on Cody) for quite awhile, I'll share my 2 cents -
Overwhelmingly, solutions on Cody do not prioritize efficient code writing practices. The priority (generally) is to get a lower solution size. That is the reason why so many cheats have been used till date and some cheats are still around.
Only a few players, out of 99k+ users write a "maintained" code - using proper variable naming and formatting, not using 'ans' as the output variable (I, myself, have been a culprit of this), etc. Comments on the solutions are even rarer (even I have only started to comment quite recently)
(maintained used synonymous to readebility)
I've learnt about good coding practices (pre-allocating, vectorization) through MATLAB Answers only.
Though if someone is trying to do their best on Cody, our goal is to give them a proper environment to do so, acknowledge it and encourage learning as best as they could, via the platoform.
Additionally, one can learn specific usage and functionalities of many functions through Cody. It is also a good place to see and learn how other users approach problems from another perspective. Paired with use of functions as mentioned above, one can learn to write more efficient code. There are also problems to learn applications of well known algorithms. And the intriguing nature of the problems being posted regularly drives you back to Cody.
Regarding your comments on cheat solutions, @Stephen23, most cheat solutions are not valid anymore, and admins (and some other helpful users) have also tried to let the Cody users and community know about them and avoid their use.
Cody now also has a 'flag a solution' functionality, where users can report cheat/hack solutions and admins take appropriate action. Test suites of old questions are frequently updated as well to prevent hard-coded solutions.
Cody is not meant to be nor should be used to learn MATLAB, rather a platform to test and enhance your skills.
Stephen23 on 10 Jan 2023
"Cody is, in my opinion anyway, not about code golf but rather about (ideally) solving problems in an understandable, maintainable and efficient manner."
Christian Schröder
Christian Schröder on 9 Jan 2023
Hi Arunika, awesome! That's great news, I'm looking forward to the announcement.
Just to clarify, BTW, I think it is perfectly fine to use solution size for scoring, either as the sole criterion (as is being done right now) or as one of several, and I'm not suggesting that this be changed.
Arunika on 9 Jan 2023
Christian, thank you for this very thoughtful reply on the subject.
The future changes we are currently working on is exactly what you just suggested - lifting the restriction altogether once you solve it successfully. So in a way, you've read our minds! The main motivation for this change from our end was exactly what you just elaborated - Cody is more about learning from the community, than it is about being the best of them all and hiding the best from everyone. So, we are moving towards a general direction of valuing learning over competitiveness.
There will likely be anouncements about this big change once we go out with it, so stay tuned for that!
Also, thank you for the suggestion of excluding solution size from the scoring element - I will take that into consideration as we discuss improvements to Cody within our team.
Christian Schröder
Christian Schröder on 9 Jan 2023
Thanks for the reply, Arunika.
If I may make a suggestion, I would personally prefer if these restrictions were lifted altogether so that submitting a correct solution to a given problem would always allow you to view all solutions to that problem, regardless of size.
This is the behavior that is already extremely common on Cody in my experience --- so common that it left me confused enough to ask this question when it didn't happen, despite my having a fair amount of experience on and with Cody by now.
I also believe that this would be desirable for another reason: Cody is, in my opinion anyway, not about code golf but rather about (ideally) solving problems in an understandable, maintainable and efficient manner. The shortest solution isn't always the best.
At the same time, Cody is also about learning, and being able to look at the shortest solution is almost always worthwhile (unless it's a hack or a cheat). Sometimes, you'll learn about a clever new way to approach a problem that you didn't think of. Sometimes, you'll learn about a MATLAB function that you didn't know existed. And sometimes, you'll also learn how not to write code.
All of these are valuable, and for this reason I think it would be good if everyone who managed to solve a problem was also able to view all solutions to that problem, unconditionally.
BTW: I'm not suggesting that Size should be abolished, or that it should not be used for scoring anymore; that's just part of the fun. All I'm saying is that lower-size solution should be not be hidden once you've solved a problem.
Christian Schröder
Christian Schröder on 8 Jan 2023
I most recently noticed this on this problem, by the way.
Dyuman Joshi
Dyuman Joshi on 8 Jan 2023
@Arunika Oyshi @Helen Chen (idk why I can't tag Helen)

See Also