5 kyu

Shrink the maze!

Description
Loading description...
Strings
Algorithms
Logic
Puzzles
Arrays
Parsing
  • Please sign in or sign up to leave a comment.
  • RealKenshiro Avatar

    Very, very instructive Kata. Thanks!!

  • dcieslak Avatar

    Approved!

  • dinglemouse Avatar

    Typo breaks example tests

    () => stringified = stringify(map));
    
  • dinglemouse Avatar

    The example maze given in the Kata description is not really a maze - it's just a crooked path through some hedges.

    Are all the "mazes" for this Kata like the example, or can they have branching paths like a normal maze?

    • Cerbrus Avatar

      Our mazes are state of the art. They're randomly generated. Even a actual maze generator won't be as random as these are.

      In other words: There's no logic to their structure.
      It's just easier to write a little story for a maze, than for a array of booleans.

    • dinglemouse Avatar
      Question marked resolved by dinglemouse 8 years ago
  • Cerbrus Avatar

    This comment has been hidden.

  • zruF Avatar

    lol, i just wrote a nice solution for 19 characters. after that i wanted to shorten my code a little bit and then you changed it to 9 characters maximum :(

    • Cerbrus Avatar

      I'm considering adding a little leniency for the "compression".

      While it's certainly possible to get to 9 (or even 5) characters for the example map, as far as I know, there's only one approach that will get you there.
      The approach that results in 5 charactes for the example, only works for smaller maps.

    • zruF Avatar

      So basically most of the users will have the same approach. I would find it more interesting to give some more space to see more variance. You might can create a harder kata with the same problem but with few characters ;)

    • Cerbrus Avatar

      Interesting approach, by the way. For really large maps, it might even result in better compression that my intended method, as long as the map isn't too random.

      I'll double up the allowed length for now, but that won't really help you with this method...

    • zruF Avatar

      the test cases are working right now, but none of the random tests. did you change anything? There are still 9 chars maximum ;)

    • Blind4Basics Avatar

      (Hi, Do we have a chance of seeing this one translated to python...? ;o )

    • Cerbrus Avatar

      I've tweaked the tests a little. They work as intended now, allowing twice the string length of the intended solution.

    • Cerbrus Avatar

      Blind4Basics: All I know about python is it's name, I'm afraid.

    • zruF Avatar

      still failing this test: stringifyMap returned a value that is too long. Result: 16 characters. Target: 18 characters or less. Optimal: 9 characters or less.

    • Cerbrus Avatar

      Found an issue in the preloaded testing code. It should now tolerate targetlength * 2

    • Voile Avatar

      You can encode the example map in just 3 bytes.

    • Cerbrus Avatar

      Looking at the solutions we're getting, I've removed the "double target length" leniency. My solution appears to be far from optimal, so the goal is to beat that :D

    • Blind4Basics Avatar

      Blind4Basics: All I know about python is it's name, I'm afraid.

      ( too sad...! ;) but maybe zruF or Voile will be able to to it? ;)) )

    • JohanWiltink Avatar

      You can encode the example map in just 3 bytes.

      Is that a general solution that will allow any width and length?

    • Voile Avatar

      Nope, but putting a 2-3 byte overhead it can be done.

      Also, there is another way of encoding this, actually, which might be more optimal in some of the mazes.