Advent Challenge #6

Welcome to the 2020 Advent Challenge #6!

All users are welcome! :innocent: (You can still join. You don’t need to participate in previous challenges)

Earn Stars :star: to increase your chances to win a prize :gift:
More info here.

Santa informed us that the some reindeers escaped again (we did hear about this). But the reindeers did not come back after calling their names this time. So he decided to ask Claire. Claire owns a reindeer farm, is an absolute expert about reindeers and knows how to whisper to them. After some investigation, the situation is as following:

  • One of the reindeers decided to become a rock star, started a world tour but was never seen again. (There are some myths about the last gig nearby the Bermuda Triangle. Others are telling stories of heavy party nights and hangovers)
  • A reindeer fell in love with a girl bunny and entered the business of her family. Now he will deliver easter eggs and is working for Bugs Bunny Family INC. (we heard stories that there are relations to a La Familia. But the reports were denied by them and it was confirmed that all is legal, the tax is paid etc. YES we do trust them :slight_smile:)
  • Rudolph was tired from all the deliveries and stated that this business needs to be digitized and automated. He refused the next upcoming time to be part of the delivery equipe. (we saw some unofficial smartphone videos showing him trying to digitize an elephant on a really small flatbed scanner. It looked like it was his 375,846th attempt)

So Santa is really in despair. Claire had an idea to help him.

CLAIRE: “Santa, I will give you 9 additional reindeers for helping you. Some of them are rookies, others are very loyal and some of them are experienced and focused on the tasks. But you cannot mix up them randomly. This is why you need to take one member from each group and let them do a test run together. After this they will perform very reliably.”

SANTA: “Oh thanks Claire for your help. Now I will do the 3 training runs headed by the experienced ones and then we can start”

CLAIRE: "Oh Santa. you will to do some more training runs. Have a look:

  • Rookies: Rebecca, Robert, Ricky
  • Loyals: Lucas, Lili, Lars
  • Formers: Emily, Ed, Eryk

So each Former has to do a test run with every Loyal and every Rookie. Each team consists of 1 Former, 1 Loyal and 1 Rookie."

Santa : “But how to find out how many runs and groups I will do have?”

Claire :“Get the help from my friends. You can reach them on the UiPath Community Forum”

So give a help to Santa and tell him the members of the different reindeer groups that he can start with the trainings runs.

*Please include in your reply which challenge you are solving - “Beginner” or "Advanced"

Beginners Advent Challenge #6:

  • Refer to the following groups an its members:
    • Rookies: Rebecca, Robert, Ricky
    • Loyals: Lucas, Lili, Lars
    • Formers: Emily, Ed, Eryk
  • Solve the task
  • Upload evidence (screenshot/s) that you successfully obtained the results using UiPath.
    • Share a screenshot of your log message results within the pattern:
      • Team001: Emily, Lucas, R…
        Team002: …
        Team0…
  • AND Upload your XAML/uiPathproject as ZIP in your reply

Advanced Advent Challenge #6:

  • Same as described in the Beginners Section
    PLUS:
  • show on how easy your implementation can be extended for forming up the teams following this rule:
    • A team consist of one Formers Member, 1 Loyals Member and 2 Rookies Member
      • Example: Team001: Emily, Lucas, Rebecca, R… , Team002… etc

Deadline:

Submissions must be posted in this thread and will be accepted until 2020-12-18T22:59:00Z

Bonus points will be awarded for

  • the first correct solution in its category
  • the most minimalist correct solution
10 Likes

Dear Santa,

Here the solution for the beginners.

Beginners

OutputBeginner

AdventChallenge6.Beginner.zip (34.5 KB)

9 Likes

Hey Santa !

Santa, I had my practice on a similar problem before in the forums!

Ok Beginner challenge: This is a straight forward Permutations problem. I.e., the position of the item matters.
There are totally 27 Permutations where a Former leads every Loyal and Rookie reindeer

The advanced challenge just says the we have 4 reindeers in the team so all we have to do is not change anything with the Formers ordering, but take combinations for Rookie1 and Rookie2.

The changes are

  1. Editing column name in Datatable Rookies1 and “Adding a Datatable Column” Rookies2.
  2. Another small trick to get a combinations from a Rookies list is to use a try catch method to get appropriate combinations for Rookie1 and Rookie2
    image
  3. Editing the Row values in Add Data Row

Summary:
In both cases (Beginner and Advanced) we have 27 Permutations. In advanced challenge each permutation will contain a combination of 2 Rookies (Important - the order does not matter)

Here is my submission to the Advanced Advent Challenge #6 (Run the AdvancedChallenge.xaml): AdvancedAdventChallenge6.zip (8.1 KB)

This challenge was fun.

7 Likes

Hi Santa,
Please see the group and member from me as below.
[Beginners Advent Challenge #6]


6thAdvent.zip (1.8 KB)

Thanks !

6 Likes

Hi Santa,
A team consist of one Formers Member, 1 Loyals Member and 2 Rookies Member
from me as below.
[ Advanced Advent Challenge #6 ]


6thAdventAdvanced.zip (2.6 KB)

7 Likes

:santa:: I cannot believe that the reindeers have escaped again. What am I gonna do? With Christmas holiday nearing, I have a ton of work to do.

:woman:t4:: Don’t worry Santa, here’ an idea (Claire says the whole idea about training runs to Santa)

:santa:: That’s a solid idea, Claire. I suppose my robot friend could help me group your reindeers.

:woman:t4:: Certainly, Santa!

:robot:: Hello again, Santa! How may I help you?

:santa:: I need your help with doing training runs. I need you to group these 9 reindeers.

:robot:: This seems a bit complex Santa.

:santa:: What? Et tu brute?

:woman:t4:: Santa, this happens! Robot, you can get help from UiPath Forum.

:robot:: Wow, so much to explore! Robot starts working on the tasks

Advent Challenge #6, Beginner :

Workflow Screenshot:

Approach Used:
Initialize variables, use nested for each loop, print different combinations of reindeers, and use an if condition for the team count.

Bot Run Screenshot:

Advent Challenge #6, Advanced :

Workflow Screenshot:

Approach Used:
Initialize variables, use nested for each loop, print different combinations of reindeers, and use an if condition to check the item value and 2 assign activities for RookieOne and Rookie Two so, the names run in circular motion like Rebecca, Robert, Ricky, Rebecca etc and also one more if for the team count.

Bot Run Screenshot:

:robot:: I’m done Santa, here’s the workflow for future reference: UiPath-Advent-Day6.zip (6.4 KB)

:santa:: I’m out of words, my friend! What am I without you?

Santa is happy with his list of different reindeer groups.

:woman:t4:: Good luck now, Santa!

:santa:: Thanks for your valuable help, Claire!

Santa now uses the reindeer groups to find his reindeers.

Guess what happened after a few hours? :timer_clock:

Santa found his reindeers!

Santa appreciates the help from Claire :woman:t4: her reindeers :deer: his robot :robot: and all the community members on UiPath Forum.

He is now on his journey to deliver gifts again.

3_santa-claus-putting-presents-under-the-tree

Thanks for this @ppr, @Luiza, @Pablito, @Vibhor.Shrivastava, @loginerror, @Steven_McKeering, @AndersJensen and others. Appreciate your efforts!

Cheers,
Rahul

7 Likes

Dear Santa,
Hear the solution for the beginners part.


AdventChallenge6.zip (34.4 KB)

7 Likes

Organizing and coaching teams is great fun!
We start with asking how many rookies each sledge should have: 1 or 2.
image
Looping through Formers, Loyals and finally Rookies with some special rules for Rookies does the trick.
We get the ideal sledge team with {Former, Loyal, Rookie}
image

Or for two rookies like {Former, Loyal, Rookie1, Rookie2}
image

Main.xaml (17.3 KB)

Challenge#6 Advanced

7 Likes

Beginners Advent Challenge #6

Santa first ponders the challenge. In Santas opinion should be the formula

image

the right one. Where n is the number of reindeers. With nine reindeers would be 27 combinations possible.

At first Santa develop two approaches in C# to find out what possible solutions there are.

//-Begin----------------------------------------------------------------

using System;

public class Test {

  public static void Main() {

    //-Array approach---------------------------------------------------
    int i = 1;

    string[] Formers = {   "Emily",     "Ed",  "Eryk" };
    string[] Loyals  = {   "Lucas",   "Lili",  "Lars" };
    string[] Rookies = { "Rebecca", "Robert", "Ricky" };

    foreach(string Former in Formers) {
      foreach(string Loyal in Loyals) {
        foreach(string Rookie in Rookies) {
          Console.WriteLine("Team" + i.ToString() + ": " 
            + Former + ", " + Loyal + ", " + Rookie);
          i += 1;
        }
      }
    }

    //-Jagged Array approach--------------------------------------------
    i = 1;

    string[][] Reindeers = {
      new string[] {   "Emily",     "Ed",  "Eryk" },
      new string[] {   "Lucas",   "Lili",  "Lars" },
      new string[] { "Rebecca", "Robert", "Ricky" }
    };

    for(int j= 0; j < Reindeers[0].Length; j++) {
      for(int k = 0; k < Reindeers[1].Length; k++) {
        for(int l = 0; l < Reindeers[2].Length; l++) {
          Console.WriteLine("Team" + i.ToString() + ": " 
            + Reindeers[0][j] + ", " + Reindeers[1][k] + ", " 
            + Reindeers[2][l]);
          i += 1;
        }
      }
    }

  }

}

//-End------------------------------------------------------------------

In the first approach Santa uses three arrays with the names of the reindeers an loops over this array in a triple nested loop. Not elegant, but it works. In the second approach Santa uses an jagged array of strings. Last but not least Santa builds also a working solution, but the complexity is not less and Santa perceives the code as more incomprehensible. Santa decides to implement the first approach as Invoke Code activity.

Main_InvokeCode.xaml (4.7 KB)

No surprise, everything works as expected.

In this context, Santa finds it interesting that it is quite easy to convert the code into a workflow representation.

Main_Workflow.xaml (9.8 KB)

Santa is curious to see if his assumptions are correct and meanwhile he will think about expansion possibilities of his solution.

image

6 Likes

Advanced Challenge #6

Dear Santa,

we heard you have some trouble again with your reindeers!!!

You’re in luck because our tireless little robot found an easy way to select your brand new reindeers in groups!

First of all, if you want to get all different combinations from the three initial groups you just have to use nested loops and print out the element selected from each group:

and the output will be the following

In case you want 2 reindeers from the last group, you just have to maintain the same nested loops and retrieve two elements from the inner loop.
In our case we pick the current and next element, and in case of the last element we pick the first one.

So the output will always be of 27 teams:

But remember the most important lesson: next time lock up your reindeers better!!
image

AdvChallenge6.xaml (11.6 KB)

5 Likes

Advanced Advent Challenge #6

Santa is in stress. Christmas, advent challenge and the last three days Reboot Work Festival. Santa was a guest there, but fortunately no one saw him.

It was a fantastic event. If Mrs. Santa knew that. She always talks about Christmas as a core competence.

Based on the beginners code Santa modified his code a little bit.

//-Begin----------------------------------------------------------------

int i = 1;

string[] Formers = {   "Emily",     "Ed",  "Eryk" };
string[] Loyals  = {   "Lucas",   "Lili",  "Lars" };
string[] Rookies = { "Rebecca", "Robert", "Ricky" };

foreach(string Former in Formers) {
  foreach(string Loyal in Loyals) {
    for(int j = 0; j < Rookies.Length; j++) {
      for(int k = 1; k < Rookies.Length; k++) {
        try {
          Console.WriteLine("Team" + i.ToString() + ": " 
            + Former + ", " + Loyal + ", "
            + Rookies[j] + ", " + Rookies[j + k]);
          i += 1;
        } catch { }
      }
    }
  }
}

//-End------------------------------------------------------------------

Santa changes the loop, so that there are four nested loops. Yes, it works, but is this approach the right one, he asks himself.

Main.xaml (4.9 KB)

If more complex conditions are to be queried, this approach will quickly reach its limits. Santa was just wondering if LINQ with an SQL statement could be considered for this. Santa hopes that maybe, after the challenge, @ppr will share some more of his knowledge on this.

And suddenly Santa had a moment of clarity. In both cases, the same approach can be used. In the beginners challenge are the reindeers in the focus and in the advanced challenge also the reindeers but here with a combination of the rookies. So all you have to do is to replace the name of the single rookies with the name of the possible rookie pairs. On this way it isn’t necessary to change anything in the code or workflow, only the definition of the input parameters.

//-Begin----------------------------------------------------------------

int i = 1;

string[] Formers = {   "Emily",     "Ed",  "Eryk" };
string[] Loyals  = {   "Lucas",   "Lili",  "Lars" };
string[] Rookies = { 
  "Rebecca, Robert", 
  "Rebecca,  Ricky",
  "Robert,   Ricky"
};

foreach(string Former in Formers) {
  foreach(string Loyal in Loyals) {
    foreach(string Rookie in Rookies) {
      Console.WriteLine("Team" + i.ToString() + ": " 
        + Former + ", " + Loyal + ", " + Rookie);
      i += 1;
    }
  }
}

//-End------------------------------------------------------------------

Needless to say, the same result is achieved here.

image

Santa continues to think and looks forward to the next challenge.

3 Likes

Beginner Challenge

Hello Santa :santa:,

I heard that you’re in trouble again because some reindeers escaped again.

But don’t worry.

Mr.Robot :robot: is here to help you santa :santa:

He is a young programmer and with his skills & ability he will find the escaped reindeers with the help of different reindeer groups that he can start with the trainings runs.

Ok Santa, Let’s solve this problem.

Below is the workflow that will use to find the escaped reindeers.


Mr.Robot has first Initialized the all the three groups Names with their members in Array of String and Used 3 Nested for each loop for looping over the members name to print the different combination of reindeers names with the help of counter also.

Ok, Let’s run the Bot.

Santaaaaa :santa: :santa: :santa: Where are you? Please come here fast… Look what I have found. :heart_eyes: :heart_eyes:

mr-robot-elliot-computer-allsafe

I founded all the escaped reindeer names and their groups.

And here is the Output:

Thank You MR.Robot :robot: for helping me to finding my escaped reindeers. :deer: :deer: :deer: :deer: :deer:. It was a pleasure to meeting you :smiling_face_with_three_hearts: :smiling_face_with_three_hearts:. Will meet you soon. Byee :wave: :wave: :wave: :wave:

AdventChallenge_6_Beginner.zip (2.8 KB)

5 Likes

Hey! here the solution ofr the problem.
Advance

Advance.xaml (19.1 KB)

4 Likes

Advance Challenge

Hey Santa, I heard from my friend CLAIRE that some of your reindeers escaped again and you want them back.

But I’m here to help you because I’m Spider-Man

Because I have Precognitive spider-sense ability, cling to most solid surfaces and webbing ability.

With the help of my webbing ability i will differentiate the members of the reindeer groups and I will start with the trainings run.

So here is the workflow,

2

For getting the combination of 4 members from the each reindeers groups .
I will use my webbing skills to get the 4 members of group

3ae04a72-eb70-4c1e-9025-912df0633302-Spider-Man_PS4

Will use 3 nested for each loop and use the if condition to check the for each item count value and will use the 2 method

if value>1

then,

  1. Minus the value by 2

Else,

  1. Increment the value by 1.

Ok Santa :santa:

Be ready for the output result.

And here is the output result:

Thank you Spider-Man. You’re amazinggggg. :heart_eyes: :heart_eyes: :heart_eyes: :heart_eyes: :heart_eyes:

Thank you for finding my escaped reindeers :deer: :deer: :deer:

and wait. I have something special for you.


What Santa :heart_eyes: :heart_eyes:

This is for you my son for helping me. :love_letter: :love_letter:

AdventChallenge_6_Advance.zip (2.9 KB)

4 Likes

Hey @abu.behlim, loved the Mr. Robot references! :slight_smile:

4 Likes

Thank you soo much @monsieurrahul… It means alot to me​:smiling_face_with_three_hearts::smiling_face_with_three_hearts::blush::blush::v::v:

3 Likes

Advanced Challenge - Beginner & Advanced

Santa, santa, please see the teams here:

Santa I am glad that I could help! I am too lazy, so I tried to be the smallest solution

Also, the advanced solution:

Along with the code:

3 Likes

@abu.behlim you know that guy is always playing the role of a robot. Even in Computer Games ;p

2 Likes

Ho ho hoo…Mary Christmas

:evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree:

If you wish to watch my Santa Stories… :arrow_down: :arrow_down: :arrow_down: :arrow_down: :arrow_down: :arrow_down: :arrow_down: :arrow_down: :arrow_down: :arrow_down: :arrow_down: :arrow_down: :arrow_down: :arrow_down:

Episode #1 ==> :snowman_with_snow: Advent Challenge #1

Episode #2 ==>:Santa: Advent Challenge #2 (Everyone welcome to join the event!)

Episode #3 ==> Advent Challenge #3

Episode #4 ==> Advent Challenge #4

Episode #5 ==> Advent Challenge #5

:star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck:

Welcome to my Santa Story Episode #6 (Beginner & Advanced Challenge Inside)

:point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right:

CLAIRE: OK Santa here we go, I will send all the reindeer one by one now, you can start test run with them

SANTA: ho ho ho……Sure CLAIRE brings them all now …. Ho ho ho…

Santa started feeding his magical meals to reindeers…

magical meals :thinking: :thinking: :thinking: :thinking:
yes that helps reindeers to fly over the sky and that’s a special secrete of Santa’s Item.

It will increase 5 powers for reindeers …. You wanna see it :stuck_out_tongue: :stuck_out_tongue_winking_eye: :crazy_face: :shushing_face: :shushing_face: :shushing_face: ………

Ok……. Ok………. I will show you quickly

Now almost ok , Santa has done some pilot test that reindeer able to fly now

download

Now the problem that Santa has came to his mind, Since Santa saw the Jingle-Bell(:Santa: Advent Challenge #2 (Everyone welcome to join the event!)) Santa still lost his mathematics memory :crazy_face: :crazy_face: :crazy_face:

So he looks over on his recent update Sleigh whether who can be able to get the help of that as said by CLAIRE

And suddenly Santa saw that there is an Advent Challenge Going on Uipath Forum Community and one guy is sending such an awesome story around him, and also sometimes he know some special things belongs to Santa, then Santa realizes that’s the Man who made the Santa’s Sleigh Dashboard @Maneesha_de_silva

**So Santa take a call to him **

@Maneesha_de_silva Receving a call from Santa :sunglasses: :sunglasses:

@Maneesha_de_silva Hellow Santa hows goin on how may i help you ? or are you going to Gift me any thing ? :money_mouth_face: :crazy_face: :stuck_out_tongue_winking_eye:

Santa : Oh no no son, I’m in big trouble I need help and Santa said the issue to him

@Maneesha_de_silva : Oh its that’s so, it’s very simple Santa I almost done this kind of thing in my School :laughing: :grin: :stuck_out_tongue_winking_eye:
Ok now I’m sending you the data


Main-Biginner.xaml (11.3 KB)

Santa: Ho ho hoooooo… Thanks, Son

Santa : oh… son I’m in another trouble A team consists of one Formers Member, 1 Loyals Member and 2 Rookies Member how may do that please help me…

Meanwhile @Maneesha_de_silva
he is such a tricky guy, he realizes that

  • Rookies: Rebecca, Robert, Ricky can only make 3 combinations
    as
    Rebecca, Robert
    Rebecca, Ricky
    Robert, Ricky

Then again this is the same as the previous problem nothing to do much :laughing: :sweat_smile:, what he needs to do is changing Rookies as
{“Rebecca Robert”,“Robert Ricky”,“Rebecca Ricky”}


Advanced.xaml (11.7 KB)

Such a Tricky guy isn’t he? :wink: :wink:

so then he sent all those to Santa again and Santa was very happy and able to arrange his reindeers well and just jumping on to the sky for the work again.
santa-sleigh_1780995c

7 Likes