Ad
  • Custom User Avatar

    Just trying to avoid the timeout by avoiding redundant calculations across many tests.

  • Custom User Avatar

    Ok, this was fun (as always a little bit sobering to see the better solutions..), though strangely, so few people attempt this one. I think it might be a good idea to give a little more introductory info on the game rules like:
    "(Mega)Connect4 is played on a vertical, rectangular board. The players tokens drop in a column and stack on top of each other. The win condition is met when the token of the current move connects N-1 other tokens of the same kind in a vertical or horizontal line or a line parallel to the boards diagonals."

  • Custom User Avatar

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

  • Custom User Avatar

    The cache will save over time because you only run the first line of code just once, after that all the test are using by calling the function with different numbers.
    Using the dict CACHE helps u jump over test you have already done in the previous so it s faster.
    Chances are thinked the same way he did but by not using cache you are wasting time on useless tests.

  • Custom User Avatar

    "if number not in CACHE:" is always evaluated as true. So why use CACHE at all? I don't get it.