213
$\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$ Commented May 20, 2016 at 8:34
  • 21
    $\begingroup$ Wait! You ran untrusted code even though you didn't know what it did, on your machine!? $\endgroup$
    – SnakeDoc
    Commented May 20, 2016 at 21:40
  • 3
    $\begingroup$ @SnakeDoc We've been through this... ;P $\endgroup$ Commented May 21, 2016 at 3:18
  • 4
    $\begingroup$ @TomášZato I actually I was on Workplace until I saw your comment. $\endgroup$ Commented 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
    Commented May 21, 2016 at 8:19

1 Answer 1

197
$\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
  • 42
    $\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
    Commented May 20, 2016 at 6:24
  • 85
    $\begingroup$ Wow - you know the rules, and so do I $\endgroup$ Commented May 20, 2016 at 6:27
  • 7
    $\begingroup$ @Marius He did nothing, but the GEMA blocks pretty much every music video on youtube. $\endgroup$
    – sandbo00
    Commented May 20, 2016 at 6:33
  • 9
    $\begingroup$ @warspyking Remember that we are on puzzling here, so I don't think that this background story actually happened ;-) $\endgroup$
    – sandbo00
    Commented May 20, 2016 at 9:21
  • 23
    $\begingroup$ @saluce Ewe.spin(this, Directions.Right) {Baby();} Math.Round(Directions.Right); struct Baby {}; Math.Round(Math.Round(Math.Round(Directions.Right))); $\endgroup$
    – user20574
    Commented May 21, 2016 at 6:25

Your Answer

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

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