Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Square Root: the exercise is too cheesable (and/or confusing?) #508

Open
rudzik8 opened this issue Sep 10, 2024 · 3 comments
Open

Square Root: the exercise is too cheesable (and/or confusing?) #508

rudzik8 opened this issue Sep 10, 2024 · 3 comments

Comments

@rudzik8
Copy link

rudzik8 commented Sep 10, 2024

As in, it's too easy to cheese your way through it, without actually solving it.

Let's consider the top 5 solutions to this exercise, by most submitted:

image

Sorted by group:

  1. Just using standard math.sqrt. 29 people submitted it.
    It's either trying to be funny, or being lazy, or just misunderstanding the exercise. Either way, submitting such a solution doesn't help anybody, including the student. It works and it's valid, but IMO it's not a solution.
  2. Raising the radicand to the power of 1/2.
    That's better, but still. Doesn't really teach you anything. It works and it's valid, but again, not a solution.
  3. Looping through all natural numbers until you stumble upon a square root of the radicand.
    I think it's obvious that this solution would lead to an infinite loop if a floating point value was passed into it. It works but it's invalid, and obviously not a solution.
  4. Using binary search.
    Now, this is pretty creative. Binary search is introduced a few exercises prior to that, which means that you don't actually learn something new with this, but out of the other top 5, this is great (and has also been mentored). It works and is valid, and definitely is a solution.

Suggestions

  1. Add floating point values to the test, as well as natural numbers that aren't squares (e.g. 5, 12, 888).
    This would make most of the invalid but currently working solutions fail the test. However, it could also block a lot of perfectly valid solutions. See t/12815.
  2. Make the instructions more verbose.
    Specifically, discuss some of the methods that can be used to calculate square roots, show some equations to go off of, etc. The Wikipedia article linked certainly is helpful, but some people might get confused by this.
  3. Mention in the instructions that using math.sqrt isn't welcome.
    Usage of standard library functions instead of writing your own code is already discouraged in the instructions for some other exercises. It would certainly be nice to see that under Square Root too.
@keiravillekode
Copy link
Contributor

The practice exercises are based on problem-specifications shared across all tracks (programming languages).

If there are Lua-specific notes, we can append to the instructions; we do this for resistor-color

As your suggestions are not Lua-specific, the best place to discuss any proposed changes to problem-specifications is the forum.

@rudzik8
Copy link
Author

rudzik8 commented Sep 10, 2024

Thanks for the hint!

If there are Lua-specific notes, we can append to the instructions; we do this for resistor-color

Suggestions 1 and 3 certainly fall into the category of being specific to this track.

@rudzik8
Copy link
Author

rudzik8 commented Sep 10, 2024

Related: exercism/problem-specifications#2415

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants