Ad
  • Custom User Avatar

    No the _ does not convey that meaning, however I often times name my private functions suchly.
    You should indeed use defp

    I also like the solution (keep forgetting about String.to_integer) however I still fail to see
    how it passed all tests given that it does nothing concerning the tie breakers \o/

  • Default User Avatar
  • Custom User Avatar

    Ok, not an issue. Read more carefully the description:

    minimal number of moves first, then minimal length of the path. You're doing the opposite.

  • Custom User Avatar

    (forget that, I'm tired. Reading again your post)

  • Default User Avatar

    Thank you for the great cata!
    Your reference solution in JavaScript does not always find all optimal solutions by steps.
    Example:

      #    #  #     #    
        #        #       
          #  x     ##  ##
      E    #      #    # 
    #    #  #   x#   #   
    ##   #   #x#     #  #
         #  # #   ## S   
               ##        
           x    #    #  #
          x            x 
        x  x x           
         #       # # # ##
       #   #   # x## x  #
    #     # #        #   
    # #      x   ###     
     x    #   x     #x # 
      #      # #  # #   
          #    #  # #    
    ##   # # #        # #
    

    Possible optimal solutions (sorted by length):
    dldrullul (length: 40)

    Your solution: dldlllurdl (length: 30)

     # #     ##      #   #  
         #   #x  # # #      
    ##   # #  # #     #    #
    #   # #                 
         #        # #       
                  #x   # #  
    x   #           ##      
     #           xx#  S  x#x
      #  #        ## # x  x 
      x      # #    ##   ##E
    x           ## # # #  xx
                #        ## 
      # xx          x #  #x 
    #     #          #  x   
                  #    #  #x
      x         # x  x#  ## 
    #     #   #     x#      
    

    Possible optimal solutions (sorted by length):
    urdd (length: 15)

    Your solution: rdrrd (length: 7)

  • Custom User Avatar

    Is the _ for the _weight/1 to signal private use (like in python)?
    If that's the case, you can use defp instead of def to declare it explicitely.

    Nice work. I learnt the sirt hand $_weight/1 from this example
    Thanks!