How would you save the world *without* modifying this C# code? Modifying other settings are fine!
Posted by BoloFan05@reddit | learnprogramming | View on Reddit | 24 comments
using System;
class Program
{
static void Main()
{
string result = CheckMissile();
Console.WriteLine(result ?? "null");
}
static string CheckMissile()
{
if ("MISSILE".ToLower() == "missile")
{
return "missile fired!";
}
return "world is saved!";
}
}
Hybrii-D@reddit
Diagamos que algo así:
class Program{static void Main(){string result = CheckMissile();Console.WriteLine(result ?? "null");}static string CheckMissile(){if ("MISSILE".ToLower() != "missile"){return "¡misil disparado!";}return "¡el mundo está salvado!";}}BoloFan05@reddit (OP)
My intended answer was to change the system language to Turkish, Azeri or another Turkic language since that changes how the
ToLowerfunction works for the letter "I" in "MISSILE", giving "mıssıle" without the dots instead of "missile", as the Turkish alphabet has two letter pairs "I/ı" (dotless i) and "İ/i" (dotted I) instead of the regular "I/i". Thus the conditional fails, and the world is saved. Same also applies toToUpper.Your take is also good, though 😉 Desperate times would call for desperate measures.
Hybrii-D@reddit
And what happens there if the Turkish language is not installed in the system? The system defaults English and... BOOM!
BoloFan05@reddit (OP)
Yes. But you could write a BepInEx plugin that would force the program to act as if the system language is Turkish, even though the OS language is still English or something else.
CremousDelight@reddit
Least nationalistic turk
Lynx2447@reddit
Unplug the computer
BoloFan05@reddit (OP)
What if you can't?
Lynx2447@reddit
Then I'll pee on it until it tingles
BoloFan05@reddit (OP)
You have no such close contact with the missile, and the syndicate has tied you to the seat in front of the missile control computer, with access to only the keyboard and the mouse. And you can see, but you cannot modify the source code in this post. You have access to everything else in the computer except shutting it down. What would you do then?
Lynx2447@reddit
What operating system?
BoloFan05@reddit (OP)
Doesn't matter. It could be any OS.
Lynx2447@reddit
sudo rm -rf --no-preserve-root /
BoloFan05@reddit (OP)
Well played! But what if the computer is actually yours (it was forcefully taken and hacked by the syndicate) and you don't want to delete any of your files?
Lynx2447@reddit
chmod 000 super_syndicate_missle_program.cs
Ramuh@reddit
something something locale probably
huuaaang@reddit
Remove the "probably" and you're right!
probability_of_meme@reddit
Hey 100% is still probably. Full marks!!
BoloFan05@reddit (OP)
Correct! Changing the locale or system language setting of the OS to Turkish or another Turkic language was my intended answer here.
MrMagoo22@reddit
using System.Globalization; using System.Runtime.CompilerServices;
public static class WorldSaver { [ModuleInitializer] public static void SaveTheWorld() { var culture = new CultureInfo("tr-TR");
}
BoloFan05@reddit (OP)
Correct! "az-AZ" (the Azeri locale) or any other locale that uses the Turkish alphabet would also work. Great job!
Hybrii-D@reddit
`class Program { static void Main() { string result = CheckMissile(); Console.WriteLine(result ?? "null"); }
}`
Hybrii-D@reddit
class Program { static void Main() { string result = CheckMissile(); Console.WriteLine(result ?? "null"); }
static string CheckMissile() { if ("MISSILE".ToLower() != "missile") { return "¡misil disparado!"; } return "¡el mundo está salvado!"; } }
ValorisArt@reddit
[ Removed by Reddit ]
devseglinux@reddit
Honestly this is one of those fun little examples where localization/culture settings suddenly become world-saving infrastructure 😄
Without modifying the code itself, one classic approach would be running it under the Turkish locale/culture.
Because in Turkish casing rules:
"I".ToLower() does not become "i"
it becomes "ı" (dotless i)
So:
"MISSILE".ToLower()
would become something closer to:
mıssıle
Which means the comparison against "missile" fails and:
world is saved!
gets returned instead.
It’s a funny reminder that string handling, localization, and culture-aware operations can create some surprisingly real edge cases in software/security.
A lot of developers accidentally assume text behavior is globally consistent until Unicode and locale rules show up and humble everybody.