Comments (6)
For the first test, the distance from origin is ~12.73 and this is greater than 10 so 0 points are earned. I suspect that you are not correctly calculating the distance from origin. Check out the Wikipedia article on Euclidean distance.
Right. Thank you very much again.
from c.
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](https://forum.exercism.org/new-topic?title=Darts%20-%20is%20there%20an%20inconsistency%20between%20the%20tests%20and%20the%20overview%20page%20description?&body=According%20to%20the%20%5Boverview%20page%20of%20the%20Darts%20problem%5D(https://exercism.org/tracks/c/exercises/darts),%20the%20radius%20of%20the%20concentric%20circles%20are%20defined%20as:%0D%0A%0D%0A%3E%20The%20outer%20circle%20has%20a%20radius%20of%2010%20units%20(this%20is%20equivalent%20to%20the%20total%20radius%20for%20the%20entire%20target),%20the%20middle%20circle%20a%20radius%20of%205%20units,%20and%20the%20inner%20circle%20a%20radius%20of%201.%20Of%20course,%20they%20are%20all%20centered%20at%20the%20same%20point%20(that%20is,%20the%20circles%20are%20%5Bconcentric%5D(http://mathworld.wolfram.com/ConcentricCircles.html)%20defined%20by%20the%20coordinates%20(0,%200).%0D%0A%0D%0AHowever,%20the%20test%20%22test_just_outside_the_middle_circle%22%20is%20defined%20as:%0D%0A%0D%0A%60%60%60%60%60%60static%20void%20test_just_outside_the_middle_circle(void)%0D%0A%7B%0D%0A%20%20%20coordinate_t%20landing_position%20=%20%7B%20-3.6F,%20-3.6F%20%7D;%0D%0A%20%20%20uint8_t%20expected%20=%201;%0D%0A%20%20%20uint8_t%20actual%20=%20score(landing_position);%0D%0A%20%20%20TEST_ASSERT_EQUAL_UINT8(expected,%20actual);%0D%0A%7D%0D%0A%60%60%60%60%60%60%0D%0AThis%20is%20confusing%20because,%20(also%20according%20to%20the%20%5Boverview%20page%20of%20the%20Darts%20problem%5D(https://exercism.org/tracks/c/exercises/darts))%20the%20expected%20number%20of%20points%20for%20positions%20under%20the%20radius%20of%205.0%20(i.e.%20middle%20circle)%20should%20be%205%20(not%201).%20This%20causes%20the%20tests%20to%20failed%20(or%20pushes%20the%20user%20to%20implement%20something%20that%20passes%20the%20test%20-%20ignoring%20the%20specification%20of%20the%20problem).%0D%0A%0D%0AI%20see%20more%20discrepancies%20between%20some%20other%20tests%20and%20the%20specification%20of%20the%20problem.%0D%0AAm%20I%20missing%20something?%0D%0AI%20see%20the%20overview%20page%20was%20recently%20updated%20(Dec.%202022).%20Were%20the%20tests%20not%20updated%20as%20well?&category=c) 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.
from c.
The very first test is inconsistent with the second test.
The first test is defined as:
static void test_missed_target(void)
{
coordinate_t landing_position = { -9.0F, 9.0F };
uint8_t expected = 0;
uint8_t actual = score(landing_position);
TEST_ASSERT_EQUAL_UINT8(expected, actual);
}
while the second test is defined as:
Some basic Git commands are:
static void test_on_the_outer_circle(void)
{
// delete this line to run test
coordinate_t landing_position = { 0.0F, 10.0F };
uint8_t expected = 1;
uint8_t actual = score(landing_position);
TEST_ASSERT_EQUAL_UINT8(expected, actual);
}
Shouldn't the expected values be 1 and 1 respectively?
from c.
According to the overview page of the Darts problem, the radius of the concentric circles are defined as:
The outer circle has a radius of 10 units (this is equivalent to the total radius for the entire target), the middle circle a radius of 5 units, and the inner circle a radius of 1. Of course, they are all centered at the same point (that is, the circles are concentric defined by the coordinates (0, 0).
However, the test "test_just_outside_the_middle_circle" is defined as:
{ coordinate_t landing_position = { -3.6F, -3.6F }; uint8_t expected = 1; uint8_t actual = score(landing_position); TEST_ASSERT_EQUAL_UINT8(expected, actual); }
This is confusing because, (also according to the overview page of the Darts problem) the expected number of points for positions under the radius of 5.0 (i.e. middle circle) should be 5 (not 1). This causes the tests to failed (or pushes the user to implement something that passes the test - ignoring the specification of the problem).
The distance from origin to { -3.6F, -3.6F }
is ~5.09 so this is outside of the middle circle and inside of the outer circle. This is consistent with the description in the overview:
If the dart lands in the outer circle of the target, player earns 1 point.
If the dart lands in the middle circle of the target, player earns 5 points.
Since the distance from origin is greater than 5, it earns only 1 point.
I see more discrepancies between some other tests and the specification of the problem. Am I missing something? I see the overview page was recently updated (Dec. 2022). Were the tests not updated as well?
The problem specifications and implementations are machine-generated and not always updated in lockstep, but the changes are usually just additions, removals, or tweaks of tests, not wholesale re-definitions of the problem.
from c.
The very first test is inconsistent with the second test. The first test is defined as:
static void test_missed_target(void) { coordinate_t landing_position = { -9.0F, 9.0F }; uint8_t expected = 0; uint8_t actual = score(landing_position); TEST_ASSERT_EQUAL_UINT8(expected, actual); }
while the second test is defined as:
Some basic Git commands are:
static void test_on_the_outer_circle(void) { // delete this line to run test coordinate_t landing_position = { 0.0F, 10.0F }; uint8_t expected = 1; uint8_t actual = score(landing_position); TEST_ASSERT_EQUAL_UINT8(expected, actual); }
Shouldn't the expected values be 1 and 1 respectively?
For the first test, the distance from origin is ~12.73 and this is greater than 10 so 0 points are earned. I suspect that you are not correctly calculating the distance from origin. Check out the Wikipedia article on Euclidean distance.
from c.
So, what I missed, is that the function should then calculate the hypotenuse based on the Cartesian coordinates?
from c.
Related Issues (20)
- Binary Search Tree: Test root node with value == 0 is allowed HOT 2
- Newer C standard HOT 6
- [c language] - queen attack invalid test 'test_can_attack_on_first_diagonal' HOT 4
- Exercise ResistorColor is confusing or too difficult HOT 22
- Sum Of Multiples - incorrect tests HOT 3
- Implement the exercise "reverse-string" HOT 1
- Implement the exercise "high-scores" HOT 9
- Change to "community-contributions-accepted" HOT 2
- Expected and actual assertion arguments reversed in some tests HOT 2
- Docs: test framework overview links to empty article HOT 1
- More documentation to `Grade School` HOT 1
- Add `make memcheck` tip for the HELP.md file. HOT 1
- Building a training set of tags for c HOT 23
- Rework the gigasecond exercise? HOT 3
- Problems in pascals-triangle test HOT 12
- The order of the results actually matters for the Word Count exercise HOT 4
- Pascal's Triangle has a bad Test Case defining Zero Rows. HOT 2
- Exercises for #48in24 HOT 17
- pig latin in C track HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from c.