Ad
  • Default User Avatar

    A random tests on negative rounded values failed. Another try with same code has been successfull.
    I saw that it was already previously araised, and recently annouced as solved.
    Still an issue ?

  • Default User Avatar

    Why not. Pls could you write a solution corresponding to your proposal

  • Default User Avatar

    Hi ,

    just a remark about the desciption : as you clearly separate 2 cases : a==0 and a!=0, y'are not obliged to repeat if a==0 for the different subcases in the first case

  • Default User Avatar

    Hi
    I understood that in case of equality in damages between 2 weapons we have to select the first in alphabetic order ,
    with python I got an error with that order and no error with the reverse alphabetic order

  • Default User Avatar

    c'est bien ce que j'avais cru comprendre :)

  • Default User Avatar

    with a little help from ChatGPT , I succeeded to obtain the result I wanted with a 2-stairs implementation of closure , one for the class and yours called by the first one

    import inspect
    def method_logger(method): 
        def wrapper(self, *a, **kw):
            call   = method.__name__ if method.__name__!='__init__' else self.__class__.__name__
            args   = ''.join( f', {v!r}' for v in a)
            kwargs = ''.join( f', {k}={v!r}' for k,v in kw.items() )
            print(f"{call}(self{args}{kwargs})")
            return method(self, *a, **kw)
        return wrapper
    
    def class_logger(classe):
        for method_name, method in inspect.getmembers(classe, inspect.isfunction):
            setattr(classe, method_name, method_logger(method))
        return classe
    
    @class_logger
    class Atom(object):
    
    
    

    what do you think of the result ?

    without any connection : why did you use the term 'frenglish' in the discussions below ?

  • Default User Avatar

    not at ease with decorators.

    must dig

  • Default User Avatar

    thanks for this generic helpfull closure.

  • Default User Avatar

    Thanks for the quick answer.

    Simple concept, never used before on my side, but efficient, that takes more time than a simple print, especially to identify specifically both called methods and arguments.

    I'm just at the beginning of this very funny kata, as an objects' fan I appreciate a lot.

    At first I was trying to find more examples to see how atoms, added outside of branches are treated, especially how to deal with their id after the molecule's unlocking, but I had forgotten the possible use of the attribute atoms to memorize the creation's order.

  • Default User Avatar

    Hi
    A general question about debugging classes:

    • in a classical kata ,ie call of a funtion , you can print the arguments
    • when working with classes, how can I capture the sequence of instructions of a specific test

    Thanks in advance

  • Default User Avatar

    Hi

    Ok for basic tests , but why this board should return 0, for me it's 3 , but result is not accepted
    '''
    [[0, 1, 0, 0, 1],
    [0, 0, 0, 1, 1],
    [0, 0, 1, 1, 1],
    [0, 0, 0, 1, 0],
    [0, 1, 0, 0, 0]]
    '''

  • Default User Avatar

    y're right,works without, probably reflex or lazyness to improve a working code :)

  • Default User Avatar

    Hi
    my code works with the present tests ,
    but if the max of the array is simultaneously at the beginning and the end , it should fail :
    so the tests should take that conf into account

  • Default User Avatar

    Hi
    Just a remark : robots are not objects as said in the Details, but dictionnaries : code is less simple
    and if they were objects , we could have written a method for the fight

  • Default User Avatar

    what I didnt understood was that the error appeared only in the first random test. I will test now.
    Edit : It works now, and I saw that you duplicate my code to check your fix.
    If you had imposed that the input must remain unchanged, my code would have been different :)

  • Loading more items...