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

C# track, Hyper-optimized Telemetry exercise - unclear instructions #2160

Closed
vlabensky-sana opened this issue Jul 25, 2023 · 6 comments
Closed

Comments

@vlabensky-sana
Copy link
Contributor

Hello,

In the Hyper-optimized Telemetry exercise of the C# track the last paragraph seems to give vague sentence which contradicts the task.

Here's the exercise

The last paragraph goes like this:

  1. Decode a received buffer

Please implement the static method TelemetryBuffer.FromBuffer() to decode the buffer received and return the value in the form of a long.

TelemetryBuffer.FromBuffer(new byte[] {0xfc, 0xff, 0xff, 0xff, 0x7f, 0x0, 0x0, 0x0, 0x0 })
// => 2147483647

If the prefix byte is not one of -8, -4, -2, 2 or 4 then 0 should be returned.

In the last sentence it says that if the prefix byte is not one of -8, -4, -2, 2 or 4 then 0 should be returned. But at the same time in the example above it has the prefix byte 0xFC, which is 252, which is none of the numbers listed in the last sentence, and the returned type is expected to be 2147483647 which contradicts the 0 from the last sentence.

So this last sentence - what is it supposed to mean? Perhaps it needs to re-phrased to make it more clear for the reader.

Thanks!

@github-actions
Copy link
Contributor

Hello. Thanks for opening an issue on Exercism. We are currently in a phase of our journey where we have paused community contributions to allow us to take a breather and redesign our community model. You can learn more in this blog post. As such, all issues and PRs in this repository are being automatically closed.

That doesn't mean we're not interested in your ideas, or that if you're stuck on something we don't want to help. The best place to discuss things is with our community on the Exercism Community Forum. You can use this link to copy this into a new topic there.


Note: If this issue has been pre-approved, please link back to this issue on the forum thread and a maintainer or staff member will reopen it.

@ErikSchierboom
Copy link
Member

So this last sentence - what is it supposed to mean? Perhaps it needs to re-phrased to make it more clear for the reader.

Do you perhaps have a better suggestion for how to handle this?

@vlabensky-sana
Copy link
Contributor Author

As I understood the task, the only valid values of the prefix byte are these:

  • for signed short: 254
  • for unsigned short: 2
  • for signed int: 252
  • for unsigned int: 4
  • for signed long: 248
  • for unsigned long: 8.

If that's correct it means that if any of 2, 4, 8, 248, 252 or 254 is passed as a prefix byte to TelemetryBuffer.FromBuffer method then the method will return correct numeric value. If the prefix byte is none of these six values, then the method will return 0. If what I just said is correct then shouldn't the last sentence say this:

If the prefix byte is not one of 2, 4, 8, 248, 252 or 254 then 0 should be returned.

instead of this If the prefix byte is not one of -8, -4, -2, 2 or 4 then 0 should be returned.?

Or perhaps it can be removed completely. Or it may be less specific, like If the prefix byte is of unexpected value then 0 should be returned.

@ErikSchierboom
Copy link
Member

If the prefix byte is of unexpected value then 0 should be returned.

I like that! Would you be willing to submit a PR?

@vlabensky-sana
Copy link
Contributor Author

Took me a while to get back to it, sorry. Here's the PR #2163.

@michalporeba
Copy link
Contributor

@ErikSchierboom The PR has been merged, I think this issue can be closed.

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

3 participants