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

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.

7 Likes

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!!

6 Likes

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.

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

4 Likes

Beginner Challenge

Hello Santa ,

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

But don’t worry.

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 Where are you? Please come here fast… Look what I have found.

I founded all the escaped reindeer names and their groups.

And here is the Output:

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

6 Likes

Hey! here the solution ofr the problem.

5 Likes

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

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

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

Be ready for the output result.

And here is the output result:

Thank you Spider-Man. You’re amazinggggg.

Thank you for finding my escaped reindeers

and wait. I have something special for you.

What Santa

This is for you my son for helping me.

5 Likes

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

5 Likes

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

4 Likes

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

Along with the code:

4 Likes

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

3 Likes

Ho ho hoo…Mary Christmas

If you wish to watch my Santa Stories…

Episode #1 ==> Advent Challenge #1

Episode #3 ==> Advent Challenge #3 - #39 by Maneesha_de_silva

Episode #4 ==> Advent Challenge #4 - #39 by Maneesha_de_silva

Episode #5 ==> Advent Challenge #5 - #29 by Maneesha_de_silva

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

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
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 ………

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

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

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!) - #36 by Maneesha_de_silva) Santa still lost his mathematics memory

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

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

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
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 , what he needs to do is changing Rookies as
{“Rebecca Robert”,“Robert Ricky”,“Rebecca Ricky”}

Such a Tricky guy isn’t he?

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.

8 Likes

Hehehe 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😍.

3 Likes

This is creative

4 Likes
4 Likes

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

4 Likes

Workflow:

Output:

5 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

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

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

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.

Yes, you have selected 1

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

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

5 Likes

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

2 Likes

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

6 Likes

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

Beginner.xaml (7.5 KB)

4 Likes