Ad
  • Custom User Avatar

    The description says that you can:
    "
    rollback
    User should be able to rollback a set amount of turns on the go board.
    "
    Accordingly, the rollback method takes one argument - the number of steps back. Which means to return the state of the board n moves back. This means that every movement on the board must preserve the previous state of the board in order to return to it if necessary.
    For example, after movements for board 9x9, the result will be a board:

    moves = "7A", "1A"
    board = '''
      A B C D E F G H J
    9 . . . . . . . . .
    8 . . . . . . . . .
    7 x . . . . . . . .
    6 . . . . . . . . .
    5 . . . . . . . . .
    4 . . . . . . . . .
    3 . . . . . . . . .
    2 . . . . . . . . .
    1 o . . . . . . . .
    '''
    

    If the rollback method with argument 2 is called, the result will be a starting board:

    board = '''
      A B C D E F G H J
    9 . . . . . . . . .
    8 . . . . . . . . .
    7 . . . . . . . . .
    6 . . . . . . . . .
    5 . . . . . . . . .
    4 . . . . . . . . .
    3 . . . . . . . . .
    2 . . . . . . . . .
    1 . . . . . . . . .
    '''
    

    I hope this clears something up?
    p.s. Initially did not specify, I will add, that together with the rollback of the board, rollback should also be made for the order of the players' moves.

  • Custom User Avatar

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

  • Custom User Avatar

    Nonsense, the kata is fun to the point when you start encountering weird ideas that author came up with to "spice" things up. Most ridiculous of which is something called "rollback", which I have no idea how it is supposed to work and description certainly does not clarify this. It has nothing to do with the game of Go and is total nonsense. Basically I have written the whole solution but cannot get it through random tests because idk what author had in mind.

  • Custom User Avatar

    Did you implement fib for negative inputs?I had also implemented O(log n) but I had forgotten to consider negative inputs and that made the function recur infinitely.

  • Custom User Avatar

    Thanks @hobovsky + @XRFXLP - will do :)

  • Custom User Avatar

    Maybe you could provide some useful info in this thread: https://github.com/codewars/runner/issues/27

  • Custom User Avatar

    This forum is obsolete, open an issue in this repo for adding a new language.

    And what would need to be done, to "do" that? :)

    You should check out the issues of requested languages in order to get acquainted of requirements.

  • Custom User Avatar

    Hey guys,

    awesome website - when I was still developing in JavaScript / ECMA Script, this site made my day :)
    I am currently developing in ABAP and as crazy as it seems -> ABAP is now finally moving to "newer" syntax: https://blogs.sap.com/2015/10/25/abap-740-quick-reference/

    With this in mind one of the first things that crossed my mind was: Is there a way to "add" ABAP as a coding challenge language too?

    • With the corresponding challenges it would help me (and others) to start utilizing these new features too.

    What do you think? And what would need to be done, to "do" that? :)

    Looking forward to your feedback!
    KR,
    ebbmo

  • Custom User Avatar

    In theory I agree, but as a user it's frustrating to spend half an hour to an hour figuring out the solution to than have to give up because you cannot find some specific optimization. For me and probably most of this site users it's unclear if the Kata will be 90% problem and 10% speeding it up or the other way around. Also I don't think the said approach with 'counter' works with all implementations of tests although I might be wrong. From the user experiance perspective the lack of corralation between idea quality and execution quality of Katas is the most conspicuous thing about this site. Anyways thanks for the reply.

  • Custom User Avatar
  • Custom User Avatar

    I found examples where you can brutforce solution with C but not Python

    This should be reported as a kata issue.

    My sugestion would be to make performance and normal version of all those performance Katas

    Kata creation is the users' ability, not a CW's function or CW developers' responsibility.

    or at least flag them

    Katas with performance requirements often have tags like performance, optimization, math, and/or performance-specific notes in the description about the input size or approximate time complexity that is expected. If some kata has performance requirements but doesn't provide any information about it, you should ask the author to do so.

    Secondly it should be clear what kind of performance you are getting

    If solution times out, it's too inefficient - as simple as that. Figuring out your code's time complexity is your job, and if for some reason you want to know how many tests you're passing, you can always do something like this:

    counter = 0
    
    def solution(...):
        global counter
        counter += 1
        print(f"Solution called #{counter} time(s)", flush=True)
        # your code...
    
  • Custom User Avatar

    I would very much like if something was done with performance Katas. Right now the situation is that you can find interesting Kata, solve it and not be able to submit it due to not good enough speed. As far as i know there exists no way of actually telling how far your solution is from being good enough which makes improving your solution annoying. Also provided test often do not include performance versions of the problem. This means you really just cannot test your code on a problem. To add to this some languages are faster than others and I found examples where you can brutforce solution with C but not Python. I get it, it's hard to manage all this in a right way.
    I don't think however this should be the reason for sloppiness.

    My sugestion would be to make performance and normal version of all those performance Katas or at least flag them. Secondly it should be clear what kind of performance you are getting and what is expected. Otherwise all those problems are basically training in Googlefooing the most efficient algo.

  • Custom User Avatar

    Exactly, some expected outcomes would be good!

  • Custom User Avatar

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

  • Custom User Avatar

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