@steffan153 - looks like your edit beat mine by 14 minutes. I used a variable for the tolerence, and my diff only includes the lines I changed.
This is my first Kata Edit, so I am not sure how revisions are resolved.

Only one of those could be the exact match to the original solution.

In general, it would be best to ask the programmer to round to a specific number of digits, then you can check for exact answers.
At this point, you do not want to invalidate any solutions.

One way to fix the problem is allow for a margin of error (perhaps after 10 decimal places) in the solution.
Then in the description you might want to include

"Solutions are checked for accuracy to 10 decimal places"

EDIT:
Assert.AreEqual has a third parameter that was not being used: Assert.AreEqual(double expected, double actual, double tolerance);
I added a tolerence to the tests in C#. Please try it again now.

Sorry that it was broken, I do these during my spare time at work so didn't see the replies, I do believe it was solved right?

I didn't notice dx

I thought we weren't allowed to use loops?

@ FArekkusu

Your link is to MSTest, using Microsoft.VisualStudio.TestTools.UnitTesting.

C# on Codewars is using NUnit. The syntax is often similar (and is the same in this case).

https://github.com/nunit/docs/wiki/Assert.AreEqual

Last I checked NUnit was still more popular, even though MSFT has included MSTest in Visual Studio since 2015.

@steffan153 - looks like your edit beat mine by 14 minutes. I used a variable for the tolerence, and my diff only includes the lines I changed.

This is my first Kata Edit, so I am not sure how revisions are resolved.

Do the same as you do in Python?

@Lozu @GalGurGurevich @KrenVsem @dlcoe: I added a 1e-8 error margin, please try again.

I don't consider this a spoiler, but mods can mark it if they really feel like it:

Only one of those could be the exact match to the original solution.

In general, it would be best to ask the programmer to round to a specific number of digits, then you can check for exact answers.

At this point, you do not want to invalidate any solutions.

One way to fix the problem is allow for a margin of error (perhaps after 10 decimal places) in the solution.

Then in the description you might want to include

EDIT:

Assert.AreEqual has a third parameter that was not being used:

`Assert.AreEqual(double expected, double actual, double tolerance);`

I added a tolerence to the tests in C#. Please try it again now.

Off by one error. I was confused by the wording in the error message, fixed it now, thanks

;p

QUESTION:

Passed all initial tests, but on random tests I get geht following problem:

World given:

1X00X0X0000X000000000000000000000100X000X010X10X000000000000

Error:

80.76923076923077 should be close to 57.69230769230769 with absolute or relative margin of 1e-09

Lets do a dry run:

1X00X0X0000X000000000000000000000100X000X010X10X000000000000 will be:

0000000000001X00X0X0000X000000000000000000000100X000X010X10X since first an last continent are connected.

Replacing all 0s which are on the same "continent" with 1s yields:

1111111111111X00X0X0000X111111111111111111111111X000X111X11X

Counting 42 "infected"(1s) within a total polulation of 52 being around 82%.

What did I miss?

How should i fix this?

.

I have the same problem in C#.

But if I use decimal, I see next result:

And I have no idea, how to find solution for this problem.

## Loading more items...