You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
robot-name: collision detection not convincing #61
differentRobotsHaveDifferentNames and resetName are not proper tests for detecting collisions. They need many more iterations to be convincing (~1/670000).
@exercism/java I've been playing around with this, and can't find any solution that both involves randomness and doesn't asymptotically creep toward finishing in any reasonable amount of time.
I am wondering if, by imposing the requirement of randomness and a range of 670000 names, we haven't set ourselves up for failure.
Currently the solution involves generating a name, checking if it's been used, and if it has, try randomly regenerating again. Any ideas on a better approach that preserves both the size of the set and the randomness?
The easiest way were to prepolutate a set of available names (maybe
represented as integers that maps to robot names via another function) and
randomly pick an element from that set and using it as the name for the new
robot.
Matthew Morgan <notifications@github.com> schrieb am Di., 3. Jan. 2017 um
13:48 Uhr:
@exercism/java <https://github.com/orgs/exercism/teams/java> I've been
playing around with this, and can't find any solution that both involves
randomness and doesn't asymptotically creep toward finishing in any
reasonable amount of time.
I am wondering if, by imposing the requirement of randomness and a range
of 670000 names, we haven't set ourselves up for failure.
Currently the solution involves generating a name, checking if it's been
used, and if it has, try randomly regenerating again. Any ideas on a better
approach that preserves both the size of the set and the randomness?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#61 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AADmR0zvWoCqreMdwN742w7plJWEpvPlks5rOkO0gaJpZM4Fy1LY>
.
@NobbZ maybe removing the selected name from the list, to avoid needing to check for uniqueness? Then we would always know the name was valid and unique. I think that will work.
General (black box) tests for randomness are either very intense or always prone to failure some (controllable) percentage of the time. Neither are suitable here, unfortunately. I don't think we'll be able to exhaustively check all possible values, so the practical solution may be to come up with a set of approximate tests that yield 'reasonable' certainty. This could be accompanied by comments or notes in the hints describing why testing randomness is so hard.
Another thought: perhaps we could update the robot interface to accept a generating function. Then we could insert our own generating function during the tests and verify in a smaller case?
I had a similar solution. It has an interesting design pressure on the solution itself since relying on pure randomness generates a long tail of run-times (prompting an interesting conversation about resource trade-offs of memory for time).
@matthewmorgan this conversation started some time before your plate got quite full. I'm gonna pull the assignment... if you have a desire squeeze in hitting this, call dibs with a PR.
I have a feeling that the specification of this exercise disallows convincing tests. There's no canonical test data. If anyone is interested in picking this up in the future I'd recommend starting by reviewing the tests in other tracks to see if this conundrum has already been worked around someplace else.
Activity
[-]robot-name[/-][+]robot-name collisions detection not convincing[/+][-]robot-name collisions detection not convincing[/-][+]robot-name collision detection not convincing[/+]jtigger commentedon Sep 18, 2015
Yeah, I had a similar reaction to this exercise.
I was thinking of doing something definitive to cover.
What to you think of something like this?
Would need to extend the API to be able to signal to
Robotthat it can "reset".edescourtis commentedon Jan 12, 2016
@jtigger Sounds like an improvement.
matthewmorgan commentedon Jan 3, 2017
@exercism/java I've been playing around with this, and can't find any solution that both involves randomness and doesn't asymptotically creep toward finishing in any reasonable amount of time.
I am wondering if, by imposing the requirement of randomness and a range of 670000 names, we haven't set ourselves up for failure.
Currently the solution involves generating a name, checking if it's been used, and if it has, try randomly regenerating again. Any ideas on a better approach that preserves both the size of the set and the randomness?
NobbZ commentedon Jan 3, 2017
matthewmorgan commentedon Jan 3, 2017
@NobbZ maybe removing the selected name from the list, to avoid needing to check for uniqueness? Then we would always know the name was valid and unique. I think that will work.
stkent commentedon Jan 3, 2017
General (black box) tests for randomness are either very intense or always prone to failure some (controllable) percentage of the time. Neither are suitable here, unfortunately. I don't think we'll be able to exhaustively check all possible values, so the practical solution may be to come up with a set of approximate tests that yield 'reasonable' certainty. This could be accompanied by comments or notes in the hints describing why testing randomness is so hard.
Another thought: perhaps we could update the robot interface to accept a generating function. Then we could insert our own generating function during the tests and verify in a smaller case?
NobbZ commentedon Jan 3, 2017
This was implied. Sorry for not beeing explicit.
[-]robot-name collision detection not convincing[/-][+]robot-name: collision detection not convincing[/+]jtigger commentedon Mar 8, 2017
@matthewmorgan we got yer name on this one... do you have time to tackle this? Or should we release it into the backlog (i.e. unassign it)?
matthewmorgan commentedon Mar 8, 2017
@jtigger I have a solution for this, but it is pretty long running. The best comprehensive solution I could come up with was:
I recommend we either test a subset or pursue @stkent's idea of supplying a generator.
If we can get a consensus on this I can implement it. @exercism/java ? Any feelings about this?
jtigger commentedon Apr 7, 2017
I had a similar solution. It has an interesting design pressure on the solution itself since relying on pure randomness generates a long tail of run-times (prompting an interesting conversation about resource trade-offs of memory for time).
@matthewmorgan this conversation started some time before your plate got quite full. I'm gonna pull the assignment... if you have a desire squeeze in hitting this, call dibs with a PR.
stkent commentedon Jun 12, 2017
I have a feeling that the specification of this exercise disallows convincing tests. There's no canonical test data. If anyone is interested in picking this up in the future I'd recommend starting by reviewing the tests in other tracks to see if this conundrum has already been worked around someplace else.
stkent commentedon Aug 16, 2017
Closing until there's interest in actively working on this again.