Ad
  • Custom User Avatar

    Your code uses global vars and they keep their value between tests, that's a problam with your code, not with Codewars. Read the docs: https://docs.codewars.com/training/troubleshooting#your-solution-seems-to-work-or-is-close-to-working-but-still-fails-tests

    In this case, you keep adding elements to the array and your code only checks the first 3. So, if the first test is giving you a 0, all the other tests will give you the same result.

  • Custom User Avatar

    If codewars is the problem, how are you going to duplicate finding the correct answer by using codewars?

    The code runs fine in vs code. The test arrays I've been using have come directly from codewars' attempt to run the code. Each time, the test produces correct answers locally, in vs code, and incorrect answers on codewars. It's weird, but I have not been changing the code; I've been copying and pasting completely. So either something is working that shouldn't be in vs code, or something isn't working that should be on codewars. Or I'm missing something, completely.

    I don't see how adding a new sample test would be the solution, if I understand what you mean. It's possible I don't.

  • Default User Avatar

    I ran your code on Codewars.

    You can do exactly what I did, which was add the test you provided above to the Sample Tests. When you run the code, you will see -1 for that test.

  • Custom User Avatar

    The console log agrees with the result in both cases (on codewars and on my local computer).
    Where are you getting the -1 return?
    Have you tried running it in vs code?
    I don't see why they would not agree.

  • Default User Avatar

    For the test example you provided, your code actually returns -1.

    Furthermore, the notion that Console.log() is not functioning properly on Codewars is also extremely unlikely.

  • Custom User Avatar

    For the following board: [[2,2,2],[0,1,1],[1,0,0]] - Expected: 2, instead got: 0

    On my local machine, when I enter the given array

    isSolved([[2,2,2],[0,1,1],[1,0,0]]);

    I receive a 2 locally, but on the site, it returns a 0. The console log is also wrong online, but correct on my machine.

    I've checked every failed test, with the same results.

  • Default User Avatar

    The odds are extremely high that your vs code has incorrect testing.

    Can you give an example?

  • Custom User Avatar

    Failures in the attempt here complete with correct results in vs code.

  • Default User Avatar

    In my opinion this cata not contain enough tests (I go it on Python), it's too easy to hardcode and pass it. For example there have place lack of tests for 'O', i make very simple one check for 'O' in row, and successful pass it. It's not check on columns or diagonal for 'O', or diagonal from right to left for 'X'

  • Custom User Avatar

    There are no tests in Python for antidiagonal(counterdiagonal) - board[0][2] - board[1][1] - board[2][0]

  • Default User Avatar
  • Custom User Avatar

    Approved, nice work

  • Custom User Avatar

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

  • Custom User Avatar

    Javascript & Coffescript: Missing sample test

  • Custom User Avatar

    Resolving this suggestion - Since this kata has been approved a long time ago, applying this suggestion would needlessly invalidate all solutions.

  • Loading more items...