212
$\begingroup$

Well this is strange.

I forgot to lock my monitor when I walked away from my desk, at work, and one of my co-workers decided to have a little fun.

When I got back, I found this little C# console app code segment, sitting forefront on my machine. I ran it a few times, but the results don't really tell me anything.

Does anyone else know what this could mean??

void Main()
{ 
  GetEwe();
  Console.WriteLine($"You have been given: {Ewe}");  
}

public enum Directions { Up, Down, Left, Right, Forward, Backward, Diagonally };
public Directions? Ewe;

public Directions GetEwe()
{
  Random rand = new Random(DateTime.Now.Millisecond);
  do
  {
    Ewe = 
    (
      from direction in Enum.GetValues(typeof(Directions)).OfType<Directions>()
      //let u = Directions.Down     
      select direction
    ).ElementAt(rand.Next(0, Enum.GetNames(typeof(Directions)).Length));
  }
  while (Ewe == Directions.Up);
  return Ewe.Value;  Around();
}

private void Around()
{
  Ewe = null;
}
$\endgroup$
10
  • 90
    $\begingroup$ With the new site icon and the introduction to the post, I thought I'm on Workplace. $\endgroup$ May 20, 2016 at 8:34
  • 20
    $\begingroup$ Wait! You ran untrusted code even though you didn't know what it did, on your machine!? $\endgroup$
    – SnakeDoc
    May 20, 2016 at 21:40
  • 3
    $\begingroup$ @SnakeDoc We've been through this... ;P $\endgroup$ May 21, 2016 at 3:18
  • 4
    $\begingroup$ @TomášZato I actually I was on Workplace until I saw your comment. $\endgroup$ May 21, 2016 at 7:29
  • 4
    $\begingroup$ @SnakeDoc It's obvious that it doesn't do anything bad, (no undefined behaviour, no file I/O, etc.) but it's not obvious what it does do. $\endgroup$
    – wizzwizz4
    May 21, 2016 at 8:19

1 Answer 1

198
$\begingroup$

I guess this is

A rickroll

Because

This code is never going to give you (Ewe) up, because the loop will assign a random direction to ewe as long as it is up
It is never going to let you (u) down, because the line//let u = Directions.Down is just a comment.
Since the return statement happens before calling Around(), it is obviously never going to run around.
And, because the method Around() is never called, it is also never going to "desert you", because it will never assign a null-value to Ewe.

$\endgroup$
23
  • 41
    $\begingroup$ For the fun of it you might want to put the link to the youtube video instead of your guess...you know, so people understand it better, not for any other reason :) $\endgroup$
    – Marius
    May 20, 2016 at 6:24
  • 85
    $\begingroup$ Wow - you know the rules, and so do I $\endgroup$ May 20, 2016 at 6:27
  • 9
    $\begingroup$ @warspyking Remember that we are on puzzling here, so I don't think that this background story actually happened ;-) $\endgroup$
    – sandbo00
    May 20, 2016 at 9:21
  • 7
    $\begingroup$ @sandbo00 Remember we are on puzzling here, so my comment contributed to the storyline itself ;-) $\endgroup$
    – warspyking
    May 20, 2016 at 9:23
  • 23
    $\begingroup$ @saluce Ewe.spin(this, Directions.Right) {Baby();} Math.Round(Directions.Right); struct Baby {}; Math.Round(Math.Round(Math.Round(Directions.Right))); $\endgroup$
    – user253751
    May 21, 2016 at 6:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.