Ad
  • Custom User Avatar

    There are practical reasons, why some Go software has rollbacks. It gives the player the possibility to analyse their game play on the computer, just like on a real Go board: Taking back a number of moves and try a different variation to see if the outcome is better than the original (main) variation of the game. Also you can save game records with the real game as main variation and show some side variations, including comments why this variation is better and that is worse. This is usually done by stronger Go players and is replayed by weaker Go players using Go software capable reading these game records. There is a notation protocol (the GTP protocol) , which most common Go software use to read and write Go game records.

  • 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

    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

    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

    Exactly, some expected outcomes would be good!