Advent Challenge #6

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

Hehehe :grin::grin: yeah I know his role @seanrockvz13 .I have watched all the season of Mr. Robot and now I’m the biggest fan of Mr. Robot😍.

2 Likes

This is creative :fire:

3 Likes

:star_struck: :heart_eyes: :smiling_face_with_three_hearts: tnx @monsieurrahul

3 Likes

@Maneesha_de_silva 6 challenges completed! 2 more to go my friend

3 Likes

Beginners Advent Challenge #6:

Workflow:

Output:

XAML:Advent_Challenge6_Beginner.zip (36.2 KB)

4 Likes

@ppr i dont think Santa likes to find his Reindeers… And this is the reason why…

Infact, we have found the reindeers. i talked to Santa and share with him the location of each one…

But he let them do what they want to do and i will enjot this new ride instead…

But to give you an idea on what the reindeers are actually doing… Please see the images below

The first Reindeer, we have Triangulated and identified that indeed, He is inside the Bermuda triangle…

Zoom in 50X

image

Another Reindeer who was thought to be working in Bugs Bunny Family INC was just stuck down there because he is being asked to play basketball

However for Rudolph, he realized using the scanner does not work properly. Hence, he just started a modelling career for a 3D Printer instead

image

All the while we thought Santa’s Reindeers are running away… but infact, Santa is actually letting them run loose…

And this is another reason Why…

It seems, the REINDEERS ARE BEING AUTOMATED!!!

HOLD ON!!!

Santa just called me!!!

He said that Claire will be providing 9 Reindeers to help him deliver the goods.
Santa cannot reject this, because currently, it is a secret that the REINDEERS ARE BEING AUTOMATED so he is somehow willing to accept the 9 Reindeers so that the people would not know about his AUTOMATION PLAN

image

REINDEERS ARE BEING AUTOMATED!!! REINDEERS ARE BEING AUTOMATED!!! REINDEERS ARE BEING AUTOMATED!!!REINDEERS ARE BEING AUTOMATED!!! REINDEERS ARE BEING AUTOMATED!!!

So, no choice, he has to ask for help to train the reindeers

Good thing we have a very nice training ground just set up recently

Lets begin with the beginner Challenge

BUT 1st!! You need to enter the number of Rookies you want in the training.

image

Yes, you have selected 1

image

For the Advanced Challenge,

Please select again the number of Reindeers in the Group

Yes, you have selected 2

You might have noticed that the numbering is Perfect, from 1 to 27.

That is because i asked my good friend Marie Condo to help declutter it for you

image

It looks good organized Santa right?

Sooo please next time, do not let the Reindeers Loose.

If you dont want to fly with them on your next trip.

Let us know…

By the way, Marie also went to your bedroom and tried to clean it and declutter it.

everything has been organized and decluttered.

Including this .xaml file that contains the solution for beginner and advanced

The solution to my code is also here for you to view



Advent Challenge 6.zip (4.3 KB)

Advent Challenge 6!!!

4 Likes

@seanrockvz13 thank you, hehe yes! let me try with an ultimate story for next :stuck_out_tongue_winking_eye: :wink: :heart_eyes:

1 Like

Hi Santa
Here is my solution for Challenge 6 Beginners
Main.xaml (9.9 KB)
Solution is pretty simple.Loop through each Array and display the Team combination.And here is a snapshot of execution

5 Likes

Beginner
Hello Santa ! :santa:
I created for you the solution for beginner level :

Beginner.xaml (7.5 KB)

3 Likes