Ad
  • Custom User Avatar

    Thank you for your quick responses, the option flush=True works.

    I am also thinking that it hits an infinite loop, that is why I wanted to print out the cases. Now I can see them. Thanks again.

  • Custom User Avatar

    Some info in this wall of text

    Basically, when your code times out, most of the info about what has been done is lost, that's why you get "0 passed". That doesn't mean you actually passed no test.
    To get a feedback anyway, you can print to the console and enforce the flush of the standard output: print(..., flush=True).

    About your current problem, I guess that your correction introduced another bug where your code goes into an infinite loop.

  • Custom User Avatar

    You could force something to be shown in console (even when it times out). Use print(something, flush=True)

  • Custom User Avatar

    Hi, I have a weird problem with the Kata. I am solving it in Python.

    I wrote a solution which passes on average 490/500 random tests and fails on around 10. Execution time is around 3500 ms.

    I printed out the random matrices from one trial where it did fail and found which case my algorithm was missing.

    I corrected it by literally adding one "if" statement. I checked the timing on my local machine and it barely changes the execution time and works well on all the cases where it previously failed.

    However, now that I try to run it on CW I get Execution Timed Out. What I find really confusing is that now it says "Passed: 0" and when I try to print something to the console it does not show at all. Is this the standard behaviour when "Execution Timed Out?"

    I will try a different algorithm for solving the kata but I am just curious about what is going on.

  • Custom User Avatar

    Just to be sure... am I right that we should expand the board with black squares? Sounds a bit unintuitive to me.
    Great idea, however, I have a lot of fun coding it.

    Edit: OK, I got it, my assumption was right. Awesoma kata!

  • Custom User Avatar

    I actually even get "WON!" printed out in the log. And the result is equal 4 blacks. But it does not pass the test.
    Iteration number is usually around 6-7 guesses.

    EDIT: I managed to find the way but this was quite tedious for me to exactly understand what was meant.