Ad
  • Custom User Avatar

    I wondered how you got the test case of fire_drill,

    public void testFireDrill() {
        final int[][] queues = {
          new int[0], // G
          new int[]{0,0,0,0}, // 1
          new int[]{0,0,0,0}, // 2
          new int[]{0,0,0,0}, // 3
          new int[]{0,0,0,0}, // 4
          new int[]{0,0,0,0}, // 5
          new int[]{0,0,0,0}, // 6
        };
        final int[] result = Dinglemouse.theLift(queues,5);
    

    For some reason lots of people have trouble with this one, although everything follows the same rules so failing just this clearly means you did not implement all the rules correctly yet. Notice for the fire drill everybody wants to go DOWN, and remember that the lift start on the ground so begins its journey going UP.

    I don't know your problem but I can guess paying closer attention to the rules of the empty lift might help .... "When empty the Lift tries to be smart. For example, if it was going up then it may continue up to collect the highest floor person wanting to go down"...

    Cheers.

  • Custom User Avatar

    first of all i would like to thank dinglemouse for this really awesome kata, even though i haven't solved it yet, i have had fun pondering it so far. the simple tests have all been successful, but in the advanced tests, 2 fail: fire_drill and random. When I read your question, I wondered how you got the test case of fire_drill, for example?

  • Custom User Avatar

    as this behaiviour is not really useful

    Unavoidable. The lift doesn't know when it is full...

  • Default User Avatar

    Had the same problem, as this behaiviour is not really usefull. Guess we have to read the instructions more carefully

  • Custom User Avatar

    I have the same question. From the instructions, it seems that it would start by going to 5th, 4th, then back to 0 to drop them off.
    Unfortunately, the comment dinglemouse made has been hidden, so I apologize if you already answered this.
    (python)

    Edit: nevermind. I was able to see that comment. I'll reiterate the rule dinglemouse quoted in case anybody else has the same confusion.

    When called, the Lift will stop at a floor even if it is full, although unless somebody gets off nobody else can get on!

  • Custom User Avatar

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