Ad
  • Custom User Avatar

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

  • Custom User Avatar

    In the description:

    maze[1][1].west = maze.cell(0,1);
    

    What is maze.cell(0, 1)? Isn't maze a 2d array?

  • Default User Avatar

    JS: Node v14 should be used along with its appropiate assertion tools (Mocha + Chai).
    Refer to this and this

  • Custom User Avatar

    Natural compare intend to let "file 2" be less than "file 10"

    What is "natural compare"? Random example which can mean absolutely anything is not a specification.

  • Default User Avatar

    Your job (along with the IT elves) is to take this route network and find a path — any path — from a starting point to an end point.

    if it's any path, why is there is there a test checking the length of the path? (JS)

  • Custom User Avatar

    Needs random tests

  • Default User Avatar

    The helper functions are not defined when I run tests. I'm not sure if this is a problem with the kata or a glitch in CodeWars - the "submit" tests seem to run OK...

    Update:
    For anyone who doesn't want to write their own display function, here's the one I used:

    function display(maze, current /* optional, will be highlighted if provided */){
      maze.forEach(function(row){ 
        console.log(row.map(function(cell) { 
                      var symbol = stringifyCell(cell);
                      return cell === current ? '<span style="color:red;">' + symbol + '</span>' : symbol;
                    }).join('')
                   ); 
      });
    }
    
    function stringifyCell(cell){
      var c = (cell.north?'N':'')+(cell.east?'E':'')+(cell.south?'S':'')+(cell.west?'W':'');
      switch(c){
        case 'NESW': return '╬';
        case 'NES': return '╠';
        case 'NE': return '╚';
        case 'NW': return '╝';
        case 'NEW' : return '╩'; 
        case 'NSW': return '╣';
        case 'NS': return '║'
        case 'N': return "╨";
        case 'ESW':return '╦';
        case 'ES': return '╔';
        case 'EW': return '═';
        case 'E': return '╞';
        case 'SW': return '╗';
        case 'S': return '╥';
        case 'W': return '╡';
        default: return '█';
      }
    }
    
  • Default User Avatar

    Definitely not 1kyu, maybe 2 or 3. There is certainly more than one algorithm to do this.

    Considering this language, which set my first attempt in the wrong direction

    Every cell in the maze has one and only one path to any other cell.

    I assumed that it was a labyrinth rather than a "maze" based on that statement. Can you add after that a statement that says "I.e. there are no cycles in the maze." or "you can't return to a previous position in the maze without covering ground you've already been"?