You are using an outdated browser. Please update your browser for a better user experience.

Coding Challenge Four

As you stumble your way through the rugged terrain of the Patagonian Desert you find yourself upon a very curious situation. Some ways off in the distance you see a gathering of all kinds of animals. After some timely observation you realize that all of these animals are working together to make it to the top of a massive desert plateau. Each animal is able to jump further up the plateau and let down a rope so as to get the rest of the animals up to it. In certain cases two animals can be seen working together, sometimes to great effect and others to disaster!

Moveset:

  • Jump X (adding to acc)
  • Fall X (subtracting from acc)
  • LinearReverse X (go back and execute each X instructions):

Animals:

  • Cat
  • Camel
  • Dog
  • Alligator
  • Rabbit
  • Bear
  • Gerbil

Positive Animal Interactions:

  • Aligator -> Gerbil: * 2 multiplier for jump
  • Camel -> Rabbit: +10 to jump
  • Bear -> Cat: * 1.5 multiplier to jump
  • Dog -> Bear: +5 to jump

Negative Animal Interactions:

  • Bear -> Camel: -3 to fall
  • Camel -> Alligator: -5 to fall
  • Alligator -> Bear: -7 to fall
  • Dog & Cat or Cat & Dog -> Divide total feet by 1.5
    • X will not be provided so it will just be "Jump Cat/Dog, Fall Cat/Dog"

Note The order in which the animals are paired together matters! "Bear/Camel" is not the same as "Camel/Bear"

Your job is to return the final height of the Nth instruction, and to see how far the animals were able to make it!

  • If the top of the plateau is at 500 units, at what step does the animal team reach the top? What animal was the one to make it?
  • What is the number of units jumped upon finishing the set of instructions?

Input file can be copied from here.

Submission Rules:

  • Submissions must be sent to wwucs.whiteboardcoders@gmail.com with the subject "WBC Coding Challenge 4" and have the program attached.
  • Submissions received MUST come be from a Western email (ending in @wwu.edu).
  • Submissions will be tested with the input file ("WBC_CodingChallenge4_Input.txt") in the same directory as the submitted program.
  • Submissions must be able run without arguments (all file opening and reading must happen in the program).
  • Allowed programming languages: Java, Python, C/C#/C++.
  • Individual and group participation is welcome (only one gift card will be awarded to winning submission).

    Happy coding!