Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Thanks! I had fun finding as many optimization tricks as I could. This is a good kata.

  • Custom User Avatar

    Thanks! Unfortunately, this brute force method takes a very long time to solve the 6x6 version, so I'll need to think of something more subtle for that kata.

  • Custom User Avatar

    I figured it out: one of the tests has abs spelled Abs:

    (Abs(1+(2-5)-3)*sin(3+5)/2.1)-12.3453*0.45+2.4e3
     ^
    

    My code handles an ArgumentOutOfRangeException in that case and returns an "ERROR ... string, which is somehow causing the INTERNAL ERROR (EXCEPTION): Unknown char error to be presented in the output.

    Anyway, calling ToLower() on the input lets my code get past this issue, so now I can go back to fixing the other bugs in my solution.

  • Custom User Avatar

    I have a solution which passes the first set of submit tests, but then fails with this error:

    Eval_Random_Tests
    INTERNAL ERROR (EXCEPTION): Unknown char
    at Evaluation.AccountTest.Eval_Random_Tests () [0x00000] in :0 
    

    I don't think this is coming from my code...

  • Custom User Avatar

    You're right, there was a mistake in the test which corresponded exactly to a bug in my solution. I've fixed it and re-published.

  • Custom User Avatar

    Some of the numbers in the test cases are too big to fit in int, but the initial state of the solution declares the method as public static int TripleDouble(int num1, int num2). It should be public static int TripleDouble(long num1, long num2) instead.

  • Custom User Avatar

    Thanks! There appears to be a bug which is preventing me from updating the example test cases. I've filed a bug about it (https://github.com/Codewars/codewars.com/issues/144) and added a note to the kata description pointing out the typo in the example test cases.

  • Custom User Avatar

    @despinozac is probably on the right track. The test you're referring to is checking the values directly against the array passed in to the constructor, it's not using the read method on your implementation. The root problem is probably either in your write method or something like @despinozac suggested.

  • Custom User Avatar

    Sorry about that. I've updated the example test to use Test.assertSimilar rather than Test.assertEquals. The submission test uses a more sophisticated algorithm to check the results, rather than just comparing your result to another object.

  • Custom User Avatar

    This is an interesting and educational kata. Thanks for making it!

    There are a few minor issues with the description:

    The notation explanation could be clearer. You could borrow the table from Wikipedia, which is pretty clear:

    y = 1 y = 0 total
    x = 1 n11 n10 n1●
    x = 0 n01 n00 n0●
    total n●1 n●0 n

    The markdown for the table above looks like this:

    |       | y = 1 | y = 0 | total |
    |-------|-------|-------|-------|  
    | x = 1 |  n11  |  n10  |  n1●  |
    | x = 0 |  n01  |  n00  |  n0●  |
    | total |  n●1  |  n●0  |  n    |
    
    
    

    Also, the second assertion in the sample tests expects the correlation to be -.05, but it should be -0.5.

  • Custom User Avatar
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Yeah, I'm planning on making a more advanced version. I'm thinking that will include AND and OR in the WHERE clause, GROUP BY, ORDER BY, and HAVING. Think that'll be advanced enough? (I considered including wildcards and aliases, but I feel like that would just add complexity without making it more interesting. What do you think?)

  • Custom User Avatar

    The helper functions are not defined when I run tests. I'm not sure if this is a problem with the kata or a glitch in CodeWars - the "submit" tests seem to run OK...

    Update:
    For anyone who doesn't want to write their own display function, here's the one I used:

    function display(maze, current /* optional, will be highlighted if provided */){
      maze.forEach(function(row){ 
        console.log(row.map(function(cell) { 
                      var symbol = stringifyCell(cell);
                      return cell === current ? '<span style="color:red;">' + symbol + '</span>' : symbol;
                    }).join('')
                   ); 
      });
    }
    
    function stringifyCell(cell){
      var c = (cell.north?'N':'')+(cell.east?'E':'')+(cell.south?'S':'')+(cell.west?'W':'');
      switch(c){
        case 'NESW': return '╬';
        case 'NES': return '╠';
        case 'NE': return '╚';
        case 'NW': return '╝';
        case 'NEW' : return '╩'; 
        case 'NSW': return '╣';
        case 'NS': return '║'
        case 'N': return "╨";
        case 'ESW':return '╦';
        case 'ES': return '╔';
        case 'EW': return '═';
        case 'E': return '╞';
        case 'SW': return '╗';
        case 'S': return '╥';
        case 'W': return '╡';
        default: return '█';
      }
    }
    
  • Loading more items...