Ad
  • Default User Avatar

    I uhm.. decided to write a bunch of for-loops in haskell

    It's transcribed from python. I've serialized and compared test cases from both with a small handful of seeds. Haven't touched instructions, I suppose it could say something haskell-specific on the input but I wasn't feeling inspired.

  • Custom User Avatar

    Description says Moderators: please don't approve this kata yet.. Raising an issue to ensure this ;-)

  • Custom User Avatar

    Hi,

    I built a visualizer for the tests (python). It could be added in the preloaded section and called by the user to see the maps. Would be nice to have in all languages.

    Cheers

    EDIT: I had to put _script instead of script so that the code is seen => don't foget to update that

    
    I,Z = 0,20
    def show(start,end,cs):
        global I
        I+=1
        
        start = Circle(start,.3)
        end   = Circle(end,.3)
        allCs = cs+[start,end]
        A = min( c.ctr.x-c.r for c in allCs) * Z - 10
        B = min( c.ctr.y-c.r for c in allCs) * Z - 10
        
        E = max( c.ctr.x+c.r for c in allCs) * Z + 10
        D = max( c.ctr.y+c.r for c in allCs) * Z + 10
        
        def drawCircle(c, fill="transparent"):
            return ';'.join([
                '',
                'ctx.beginPath()',
               f'ctx.fillStyle = "{fill}"',    
               f'ctx.arc({Z*c.ctr.x-A}, {Z*c.ctr.y-B}, {Z*c.r}, 0, 2*Math.PI)',
                'ctx.stroke()',
                'ctx.fill()',
                'ctx.closePath()',
                '',
            ])
        print(
       f'<LOG:HTML:>Cartesian distance: {d}<BR>',
        '<canvas',
            f'id="circlescanvas{I}" height="{ D-B }" width="{ E-A }"',
            'style="background-color: #B0B0B0"'
        '></canvas>',
        '<_script type="text/javascript">',
            f'const cnv = document.getElementById("circlescanvas{I}");',
            'const ctx = cnv.getContext("2d");',
            f'ctx.translate(0,{D-B});',
            'ctx.scale(1,-1);',
            *map(drawCircle, cs), 
            drawCircle(start, "blue"),
            drawCircle(end, "red"),
        '</_script>', sep=' ')
        
    
  • Custom User Avatar

    Can't seem to pass Is_Rotation_and_Is_Reflection_Tests in c++. I checked the return value of both member functions and that looks correct, but the test still fails. Is there a third part of this test?

  • Default User Avatar

    Very interesting one. But I think the description lacks something to make it a bit less cryptic (especially in Java ; I do not know C++)): that could explain the satisfaction rate which is abnormally low.

    Saddly, I can't really find suggestions to add... In Java, a first drawback is that your test class extends Dih4. That's quite unusual (at least on CW) and that conditiones a part of the tasks to complete with the constructors. Maybe you could add that the constants will be Dih4 instances too.