Cody

# Problem 1260. RISK board game battle simulation

Solution 1925713

Submitted on 8 Sep 2019 by Le Cong Hieu
• Size: 8
• This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
a = 3; d = 0; y_correct = 1.000; assert(abs(risk_prob(a, d) - y_correct) <= 0.01)

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In risk_prob (line 2) In ScoringEngineTestPoint1 (line 4) In solutionTest (line 3)]

2   Pass
a = 1; d = 5; y_correct = 0.000; assert(abs(risk_prob(a, d) - y_correct) <= 0.01)

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In risk_prob (line 2) In ScoringEngineTestPoint2 (line 4) In solutionTest (line 5)]

3   Pass
a = 5; d = 3; y_correct = 0.642; assert(abs(risk_prob(a, d) - y_correct) <= 0.02)

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In risk_prob (line 2) In ScoringEngineTestPoint3 (line 4) In solutionTest (line 7)]

4   Pass
a = 4; d = 6; y_correct = 0.134; assert(abs(risk_prob(a, d) - y_correct) <= 0.02)

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In risk_prob (line 2) In ScoringEngineTestPoint4 (line 4) In solutionTest (line 9)]

5   Pass
a = 10; d = 10; y_correct = 0.480; assert(abs(risk_prob(a, d) - y_correct) <= 0.02)

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In risk_prob (line 2) In ScoringEngineTestPoint5 (line 4) In solutionTest (line 11)]

6   Pass
a = 7; d = 8; y_correct = 0.329; assert(abs(risk_prob(a, d) - y_correct) <= 0.02)

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In risk_prob (line 2) In ScoringEngineTestPoint6 (line 4) In solutionTest (line 13)]

7   Pass
a = 8; d = 7; y_correct = 0.5355; assert(abs(risk_prob(a, d) - y_correct) <= 0.02)

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In risk_prob (line 2) In ScoringEngineTestPoint7 (line 4) In solutionTest (line 15)]

8   Pass
a = 20; d = 10; y_correct = 0.965; assert(abs(risk_prob(a, d) - y_correct) <= 0.02)

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In risk_prob (line 2) In ScoringEngineTestPoint8 (line 4) In solutionTest (line 17)]

9   Pass
a = 4; d = 2; y_correct = 0.656; assert(abs(risk_prob(a, d) - y_correct) <= 0.02)

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In risk_prob (line 2) In ScoringEngineTestPoint9 (line 4) In solutionTest (line 19)]

10   Pass
a = 6; d = 4; y_correct = 0.638; assert(abs(risk_prob(a, d) - y_correct) <= 0.02)

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In risk_prob (line 2) In ScoringEngineTestPoint10 (line 4) In solutionTest (line 21)]

11   Pass
a = 2; d = 1; y_correct = 0.417; assert(abs(risk_prob(a, d) - y_correct) <= 0.02)

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In risk_prob (line 2) In ScoringEngineTestPoint11 (line 4) In solutionTest (line 23)]

12   Pass
a = 2; d = 2; y_correct = 0.104; assert(abs(risk_prob(a, d) - y_correct) <= 0.02)

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In risk_prob (line 2) In ScoringEngineTestPoint12 (line 4) In solutionTest (line 25)]