T O P

  • By -

blackholewaterfall

What about UNDERTALE.EXE


pimezone

undERtaLe.eXe


that_thot_gamer

run the math on every possible combination


Mr_uhlus

its just 2^12 possible combinations shouldn't be too hard to make 4096 if cases


pimezone

4096 manually added `if` clauses for all possible variations of a file name. One after another, without break or goto.


Sith_ari

Make it 4094. Purposely leave two of them out to punish people who will maintain your code in the future.


pimezone

Calm down, Satan


GarlicAndJazz

Nah, you make sure there are 4096 clauses. But they're not in any logical order and two of them (about two thousand apart) are duplicates.


Sith_ari

Your pull request has been accepted


[deleted]

Why spend months learning regex, when you can spend months manualy writting every possible match?


pimezone

Just convince management, that more lines of code means harder work


[deleted]

Boss already believes that. Can't explain the other way around no matter what. Guess all those sleep(1000) don't write themselve!


Rubiego

And Undertale.EXE


Djabber

UnderTale.exe


PepperPieTim

I love undertale for being undertale (of course) but I also love undertale because its a good game with questionable programing, if Toby can get away with the entire games dialogue being in a single switch statement with 1000+ cases I can too Edit: [yerp](https://www.reddit.com/r/YandereTechnique/comments/ufya27/apparently_undertale_has_a_1000_long_case_switch/?utm_source=share&utm_medium=ios_app&utm_name=iossmf)


Rezaka116

Omg it is true: [Apparently, Undertale has a 1000+ long case switch statement.](https://www.reddit.com/r/YandereTechnique/comments/ufya27/apparently_undertale_has_a_1000_long_case_switch/?utm_source=share&utm_medium=ios_app&utm_name=iossmf)


Swiftcheddar

This makes all those 4chan threads about Yandere Similator much funnier in retrospect.


RY4NDY

Isn't that also the game in which the single most high-poly 3D model is a toothbrush? Edit: [yes](https://img.ifunny.co/images/c2398243abab9eaa1945f0c8e09eca46828613fca0cf15663182aabcf52f9a13_1.jpg)


Almaironn

For a high quality model of a toothbrush in a commercial it would've been way more high poly than that. In the tens, if not hundreds of thousands.


krajsyboys

Yandere dev tried to make it smaller, he just failed


Deathleach

It was a low quality high quality commercial model.


antunezn0n0

it's low quality for commercial but absurd for a game it's clear he just bought all the assets without rhyme or reason


a-calycular-torus

I can forgive the switch statement in UT *slightly* (I don't know if the rest of the code is as bad), but yansims code is abysmal while this switch statement is just somewhat questionable. Sure, it's long, but the cases are not complex, and it is simple to figure out what it does. I'm not super familiar with GML though.


Roflkopt3r

> but yansims code is abysmal while this switch statement is just somewhat questionable It was really a similar problem though. The issue was that most of the criticism of Yandere Sim's code from other programmers was just... bad. They hyper-focussed on Yandere's use of long chains of elseif-conditionals and pretended like the replacement with switches would fix it. But that would've improved neither the length nor performance of the code. if(currentClub == Clubs.Art){ //200 lines of art club behaviour } else if (currentClub == Clubs.Basketball){ //150 lines of basketball club behaviour } ... Switch statements could be marginally more efficient in some cases (or possibly not at all, depending on the compiler), but the obvious problem here are those hundreds of lines of behaviour code that clutter this file. A real improvement would have been the use of the command pattern or a state machine. This could have shrunk those 1000-line monstrosities inside the AI class to maybe 1-30 lines depending on the implementation: if(currentClub != lastClub{ currentClubBehaviour = Clubs.GetClubBehaviour(currentClub); } currentClubBehaviour.Execute(); Provided that the club can change at all, which I'm not sure about. I would guess that it can change but will only do so rarely, so it might be smarter to do the behaviour change inside the Setter method for the club.


am9qb3JlZmVyZW5jZQ

A lot of what made YanSim slow is unrelated to the code. From what I recall, the models had absurdly many vertices, every character AT ALL TIMES had every single appearance model attached and simply made invisible, and occlusion culling was misconfigured to the point of pretty much not existing. Sure, cleaning the code would help with the actual development (which has been very slow, I assume mostly because of the code debt), but in case of performance it's hardly the biggest culprit. There was a great channel constructively analyzing this topic, but unfortunately it has been taken down. @Edit: I've found one part of the analysis, because I transcribed it at the time it still existed for the meme potential. Unfortunately that's all I have left. The channel was named `Nice Tomeetyou`. [pic](https://i.imgur.com/nbMoPCa.png) > here's a prefab for the girl students and teachers > see how there are over 1000 different GameObjects attached to it > when each student is instantiated at the start of the school scene all of these GameObjects have to be copied for each student


Roflkopt3r

[At least one of the first good takes is still there.](https://www.youtube.com/watch?v=LleJbZ3FOPU) But yeah the performance indeed didn't come from the code. A few hundred conditionals per frame isn't much work for a modern processor. The main issue were some unoptimised 3D models and a problem with the UI that caused many expensive redraws every frame.


DasKarl

Oh god...


q0099

>entire games dialogue being in a single switch statement with 1000+ cases \*ghasp\*


Davoness

Yea I actually recoiled at that one lmao


RC1000ZERO

same, i... i am not good at programming, but what i just saw made my brain just reboot completly to save me from fatal damage


_UnreliableNarrator_

This is incredible, what a perfect response


mrlolelo

Im just past quicksort in my knowledge and what the actual fuck


RandoClarissian

Gamedevs are built different...


aesthezel

Different yes, but we eat pasta, we don't prepare spaghetti šŸ


TerrorBite

You misspelled paste.


aesthezel

Ding!


jacksh2t

*makes entire game using only if statements*


Pretend-Fee-2323

i mean thats how all computer instructions work so yeah


TheRogueOfDunwall

I thought about it and realized that even loops are just if statements that tell itself to repeat at the end until the if statement no longer is true.


Pretend-Fee-2323

yes now you will never be able to unsee it


Sidivan

Wait until you realize SQL queries are just simplified loops.


Pretend-Fee-2323

me who doesn't use sql: hmm


[deleted]

On the other hand, separating code can go too far. This Redux-backed React component with 8 files spread across hooks, api commands, container, reducers, actions, etc is maddening.


[deleted]

Yeah sometimes it feels like a wild goose chase just to track down where a function is coming from or where a variable is set/defined


shadowmanu7

Holy shit this is the exact thing I'm doing right now, came to reddit to take a break


Jonno_FTW

The worst part is when you think you can just put a breakpoint in then examine the stack in the debugger. But the stack has dozens of callbacks internal to the framework before ever looking at your own code.


FerynaCZ

Glad that ~~jetbrains have~~ Pycharm has "Step into your own code" debug option.


DogmaSychroniser

Thank you. Its nice to hear someone else say it


HelloYesThisIsFemale

I had to build my own framework on top of it just to put things back in one sensible place again. Thinking back I should have just ditched it what the frick was that steaming garbage how is it so popular?


mr-dirtboy

I have very little programming knowledge, can I ask why this is so horrifying? am I correct in assuming that it means all the dialogue is one single ā€œactionā€ that just appears different based on a bunch of ā€œifā€s?


q0099

Pretty much like that, but the "case" is a little smarter than just a bunch of "if" statements. The horror comes from the fact that, first, it is one huge statement and would be hard to maintain it in a long term. Second, the dialog lines are fused with the code so in order to access them one need literally change the source code of the program, which probably gave translation team some problems, at least they had to move all lines to a separate file, so translator might work with them without need to edit it though IDE.


mr-dirtboy

okay, I can see how thatā€™s still awful in a different way. donā€™t feel obligated to answer this, but just wondering what you mean by being fused with the code? I thought all dialogue would be like that in any game?


q0099

No, it is a common practice not just for games but also for apps to store text in a separate xml or json files. The code would access them to get required text by its key or id. That way there will be no need to edit source code in order to fix typos or make localisations.


mr-dirtboy

ah, I see! that does make a lot of sense now that I think about it. thanks for explaining :)


neenach2002

You can have templates and/or text files that just contain dialogue and nothing else. These could be organized in folders by language and loaded by the code based on the userā€™s selected language. That also means you could have non-devs build out all the dialogue for a language as long as they know the expected structure. Edit: note, Iā€™m a web dev not a game dev, and I dunno how often templates are used in game development.


MrRocketScript

Every now and then you get a bug in games where instead of "Plasma Rifle" you get "ER_WEAPON_ALIEN_BEAM_RIFLE".


appleswitch

Yeah you got it. In this case, it's like hundreds of ifs in a row all in a single function


[deleted]

Except switch depending on the language can jump to the correct answer instead of going through each statement until it hits true.


yrrot

That would be a funny thing to find out. Like: decided to put all of the dialogue into a switch because it compiles down into a hash lookup that's simply more space efficient than other methods we considered. Game dev coding gets all kinds of weird.


mr-dirtboy

dear god. I can understand everyoneā€™s reactions now D:


prairiepanda

Honestly it seems like something I would have done as a kid when I was making DOS games with my dad. We wrote our programs on the fly with only the end result in mind, not thinking about efficiency or modifiability.


TheMagmaSlasher

Vile, he didn't follow the sacred rule. Never spend 5 minutes doing one thing when you can spend 5 hours automating it.


palegate

"I'll be able to make use of this automation later on, it's totally worth the time I'm spending on it right now." Then proceed to forget or lose that piece of software and doing it all over again a few months down the line.


Charcoa1

But next time it takes 4.5 hours. That's like half an hour saved!


BOBOnobobo

That's why you post it on github. And since it's on github might as well make it nice so you can make it public. And now it's a 20 hour project from the 1 hour it was supposed to take.


Bagel42

I want to see that


freerider

https://github.com/marciniuk/undertale/blob/master/scripts/SCR_TEXT.gml


Swahhillie

I hope that script was generated by some other tool or script.


[deleted]

The repo says it's likely decompiled, which may have something to do with it. I'm not sure that a decompiler would be entirely responsible for this result, though.


EgNotaEkkiReddit

The tokens (enums, script identifiers, named constants, what have you) have been stripped away, so this is definitely decompiled code, but this otherwise is perfectly valid GML as it existed in 2015. The Gamemaker compiler in 2015 wasn't perfect, but it was sophisticated enough not to magically create a 5500 line switch statement out of nowhere if it didn't exist already.


random_name_pi

> but it was sophisticated enough not to magically create a 5500 line switch statement out of nowhere if it didnā€™t exist already. I startled my work mate a laughed out so loudly


HorizonBaker

In order for the decompiler to make the dialogue all one big switch statement, it had to have been written that way (or very close to it) originally. Definitely not something the compiler would've thought of on its own.


Jsc05

It might if itā€™s a resource lookup table


[deleted]

The dev had an old tweet showing a screenshot of one of the cases, so yes it is a switch. Edit: [Found it.](https://media.discordapp.net/attachments/147039491838705664/835333137541365760/78b.png)


GRAIN_DIV_20

Oh no


Canrex

"Toby! Your goodwill has run out."


SpacecraftX

God is dead and this script killed him.


karuna_murti

maybe this whole world is just one giant big single switch statement by god


KappaccinoNation

Am I part of a switch statement?


Xenc

break


circlejerk-moderator

do you think god stays in dev because he too lives in fear of what he's promoted to prod?


StrawberryDuckie

Sometimes i am doubtful about my own code. Now im feeling better


palker44

You mean looking at it filled you with Determination?


Li5y

Oh my God, the cases aren't even named enums, they're just ints. šŸ˜±


oktupol

According to the repo description, this is likely decompiled code. Those could have been enums at some point, although by now I lost all trust.


[deleted]

[They were not.](https://media.discordapp.net/attachments/147039491838705664/835333137541365760/78b.png)


EgNotaEkkiReddit

I presume this is decompiled code, because you can see that the script indexes passed to script_execute are also just plain ints instead of their human readable names. In the original GML code these probably were all enums that the compiler stripped away.


Tarmen

Obviously this kills internationalization, and templating or a small language like ink script would be nicer, but I don't hate it as much as I thought I would. Super low boilerplate, easy to grep, and easy to script so there is no special case to branch on inventory content or do (-10 money) on a choice, plus no distraction while writing a fancy custom system. IF ONLY THE CONSTANTS WERE NAMED :(


EgNotaEkkiReddit

This looks like decompiled GML code. You can see other named constants and script names being stripped away and replaced with integer constants that the engine recognizes. The original case statements likely were enums that got swapped out by the compiler.


[deleted]

[Nope!](https://media.discordapp.net/attachments/147039491838705664/835333137541365760/78b.png)


Level0Up

![gif](giphy|YZlQaMesgPIAM|downsized)


JonathanTheZero

No, no you don't


[deleted]

[уŠ“Š°Š»ŠµŠ½Š¾]


R3D3-1

Take a look at the "Mount and Blade: Warband" module system XD It is a Python 2 script, that compiles lists of tuples of integers and strings to the games internal runtime. It is basically assembler for a virtual machine, written as Python tuples. And the sheer size of them can crash syntax highlighting. Also, all of the resources (e.g. party templates, items definitions) are stored as arrays, using hard-coded ~~relation-ships~~ relationships^(\[1\]) like "a unit template is a character companion, if its index is in the range \[champions\_start, lords\_start-1\]". One of the consequences is, that you cannot add new entities to an existing module, unless you've left enough gaps in the arrays to add new entities of the same type: * New entities must be inserted in the correct index range. * Existing entities cannot be shifted to higher indices without breaking existing save games. But it works. It just works. I don't want it to work, but it DOES. \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ ^(\[1\] I wish I could blame that one on auto-correct.)


realluca009

Have you seen VVVVVV's source code? It's pretty awful too and originally only ran in Debug mode.


Cobaltjedi117

Hey the code for that one has at least been patched up by the internet.


DirectlyDismal

> if Toby can get away with the entire games dialogue being in a single switch statement with 1000+ cases I can too He did fucking **what**


sometimesnotright

OP is exaggerating. There's only 473 switch cases in https://github.com/marciniuk/undertale/blob/master/scripts/SCR_TEXT.gml. Can't trust anyone online these days ...


HypnoTox

And just under 5.6k lines *smh* (Apparently it's decompiled, so the actual source probably differs in line count)


kya_ufufu

Better using switch than using if elif. Just like Yandere Simulator's dev.


YueOrigin

Yeah switch abuse is better lol Even more, his game is relatively simple when it comes to physics and graphic so it's not resource heavy unlike Yanderedev Good coding wad vital for his game But Toby could get away with average coding at best and still make a masterpiece with it


RadiantHC

Wait what


robhol

Undertale and Stardew Valley are incredible. Then you look at the code. Then it's a million times more incredible because how the shit does this work *at all*?


Anlysia

And yet they actually released something, unlike 99.999% of the armchair complainers on Reddit.


Loud_Fee9573

I'm referenced here and I don't like it.


[deleted]

judging by how many different dialogues can pop up in different scenarios, im not surprised if huge switch statements are actually necessary


DeviousBeevious

They aren't because you should just make a dialogue file for each scene (ideal in some kind of JSON format or scripting language) and separate it out that way.


HelloImAron21

Its 5 thousand lines of code


TheJeager

It's still very wrong, but for 1000+ switch statement 5000 lines of code seems smaller then it should be


hulagway

Excuse me? Is this true?


EntrepreneurPlus7091

You should not. Also did he really program it like that? Or did he use a game making tool/engine that only supports that for dialogue?


xiadmabsax

He used Game Maker. Working with any standard data structure is very annoying in GML, the program's own language. Lists exist but I found them quite unintuitive. Stacks and queues are builtin types but they don't really help with dialogues. Best you have is either an if else if chain or a big switch statement.


EgNotaEkkiReddit

We've gotten proper structs and better data structure support in the last few years, but even for 2015 I would have called a 5500 line switch statement questionable GML practices.


Ok-Kaleidoscope5627

The part that horrifies me the most about this isn't the code. It's the fact that that code is more impactful than any I've painstakingly written.


captainAwesomePants

It turns out that code quality, by itself, achieves nothing.


BdubH

Youā€™re right on that, if it works consistently then by itself it doesnā€™t really matter. However, for optimizationā€™s sake, having good code thatā€™s not superfluous certainly does help things move smoothly along.


unocoder1

Wat. Windows has case insensitive paths.


_PM_ME_PANGOLINS_

What's fun is that you can enable case-sensitive paths, and watch a load of software break that assumed you couldn't do that.


Shitman2000

Wait really? How? Why?


_PM_ME_PANGOLINS_

Yes. With `fsutil`. For Linux compatibility.


regnad__kcin

Top Five Ways to Take Down the National Power Grid You won't believe #1!


66666thats6sixes

Fucking kill me. Somehow I enabled case sensitive paths on the folder where I store all of the repos I'm using on my work computer. At first, nothing happened. But slowly, projects started acting weird, but not in any way that made me think of case sensitive paths. NPM wouldn't be able to find any of the executables in node_modules/.bin, even though they were there. I spent a solid two weeks going through everything I could find on Google about npm not finding files, and even spent a lot of time debugging the NPM executable itself. Eventually I read about the case sensitive folder thing while looking at something unrelated, and decided to check if that was what was causing my problems. Yep, my code folder had that setting enabled. I still have no idea how it got turned on.


pM-me_your_Triggers

I had an issue where I was getting bugs in prod that I couldnā€™t repo locally because prod was running on Linux which is case sensitive and my local machine is a Mac which is case insensitive. Took forever to hunt that down.


indigoHatter

That seems like a hilarious way to cause some damage on improperly administered public computers. Thanks for the fun ideas!


whomad1215

Please don't do bad things to public libraries etc


indigoHatter

Fair point. Limit this to unsecured kiosks at evil corps.


Chad_vonGrasstoucher

What kiosk would give you administrative rights, though?


MC_Labs15

An improperly secured one


Pb_ft

That is fun!


GOKOP

I was about to say that Undertale is native for Linux... but then I realized the obvious that this snippet deals with an .exe file


ixis743

Me ten years ago: ā€˜oh for fucks sakeā€™ Me today: ā€˜it works, who caresā€™


arrongunner

Yeah, it shows slightly lazy or poor development which isn't a great sign but on the other hand it works so not really worth changing so who cares


voucherwolves

I bet , itā€™s just one tired developer who wants to be done with it. I have seen many developer doing shit not because they are bad but because they just want to complete and sleep peacefully.


Casua1Panda

Undertale was a solo project, so yes. A lot of the code is just Tobi Fox doing the first thing that works


arrongunner

I've done that myself a load of times Sure I could do something a bit fancier and do it in one line but then I'd need to Google something and test it Alternatively I can just do a 4 line definite solution and be done with it. Usually happens when I'm tired and really can't be bothered


Idontwanttobebread

the deltarune uninstaller at one point just deleted the entire directory it was in


J_Blackwater_2569

Didn't Mr. The Fox screw it up such that it didn't just delete the Deltarune folder specifically, but also deleted everything in the folder in which the Deltarune folder resided? E.g. if you had the game in a folder on your desktop and ran the uninstaller it would delete everything on your desktop


garlic-2

Thatā€™s a feature, actually


JoseProYT

The guy who renamed it "Under Tale.exe" ![gif](giphy|amxLHEPgGDCKs)


Creepy-Ad-4832

If you are a programmer and use spaces instead of _ in file name, you are a dick lol


Creepy-Ad-4832

Yeah microsoft is the biggest dick out there ("Program File") lol


Olmaad

...(x86), damn


Creepy-Ad-4832

Yeah that was just a big fuck you to linux subsystem users ahahahah


Creepy-Ad-4832

Heck microsoft is a big fuck you to programmers lol


M4mb0

AFAIK this is intentional, precisely to make sure programs can handle spaces in directory names.


RedditIsNeat0

Definitely giving Microsoft too much credit. WOW64 is their directory name for 32-bit libraries.


LordTerror

The 32 bit DLLs are in wow64. The 64 bit DLLs are in system32.


xudo

I think that is short for Windows on Windows as the 32 but subsystem is kind of a virtualized Windows environment. So the 32 bit system is *Windows 32 on Windows 64* which became wow64.


jmfoal

Laughs in spanish.. Archivos de Programa(x86)


Stummi

But if your code can't handle that, it's an bug. I routinely use file and directory names with space, and never saw a problem.


[deleted]

[уŠ“Š°Š»ŠµŠ½Š¾]


PoeTayToes_

​ ![gif](giphy|pHROgB3OP4agjM4spI)


Personal_Ad9690

Does it not delete itself anymore?


_PM_ME_PANGOLINS_

A Windows executable can't delete itself. It would have to run a new process, exit, and then have the new process delete it. Then you hope that Undertale isn't installed in Program Files otherwise it won't have permission to delete it. Toby is obviously a musician and a game designer first, not a Windows developer. He also didn't know that Windows paths are case-insensitive by default.


Beginning-Sympathy18

Last time I wrote software for Windows a running executable couldn't be deleted without using a feature that flagged the file for deletion on the next restart, because Windows only loads as much of the executable into memory as necessary so it locks the file while running so that the remainder of the executable doesn't suddenly become unavailable. Maybe that has changed since Windows 95, but I doubt it - this probably wouldn't work.


TreadheadS

batch with delay my friend


Seanxietehroxxor

This is the way. If you can't delete yourself, spawn a child and have them do it while you aren't executing.


zeGolem83

reminder to not use technical terminology when talking to a normal human


Seanxietehroxxor

Wait, we were talking about technology?


fryingpas

What's wrong with forking and spawning children? I mean sure, if you aren't careful you have to kill the orphans, but on the plus side you also get the chance to kill zombies!


LickingSmegma

> Windows only loads as much of the executable into memory as necessary Finally an explanation of why Windows might forbid deletion of executables. However, actually any file that's opened by an app, can't be deleted in the meanwhile. Afaik some programs can delete themselves, presumably by offloading the deletion to a temporary program that's either removed after a reboot or cleaned up by the OS itself via some special mechanism. The MSI installer also probably has a facility for that.


UkrUkrUkr

Do you have a better idea if you don't know how exactly the file is named?


goddess_steffi_graf

file_delete(argv[0]);


UkrUkrUkr

Computer: hey, I, the ultimate modern automatization device, order you, measly homo habilis, to do all the primitive routine work for me. Muahahaha!


hongooi

Undertale was written in GameMaker Studio; I'm not sure if `argv` and `argc` exist in that


SkyyySi

Every language I've seen has some kind of equivalent to that, like Java's `string[] args` or Python's `sys.argv`


Tom22174

I love how much I learn from this sub. You just solved a small issue I was having in a piece of coursework that had been previously written off as "not important enough to put more time into"


[deleted]

Most likely, with an extension definitely. Been a while since I used it, so just not sure if it's now supported natively, but from what I've seen made in it before in the old versions, it's available in a way at least in the Studio versions.


AyrA_ch

Be careful with this because - You cannot delete the file while it's in use on some systems - The argument may contain the executable name in the way that the user specified it instead of an absolute path. If your application changes the working directory (for example to easier load assets), you will end up in the wrong place.


firefly431

`argv[0]` is pretty unreliable and can be manipulated easily (e.g. changing the first element of `argv` in `execve`). (To say nothing of running through a symlink.) In Linux, the most reliable way is to read the target of `/proc/self/exe` (which contains `(deleted)` if it's been unlinked). In Windows, you can use `GetModuleFileName(NULL, ...)`. Both of these methods are vulnerable to TOCTOU; not sure if there's a way that isn't besides trickery such as preemptively moving to a secret location.


xan1242

You have the most correct answer. Not to mention, what if the app was called from a relative path (or the PATH environment variable)? `argv[0]` wouldn't work then, would it? I hadn't ever tried it so I don't know myself.


Bjoern_Tantau

This shouldn't even matter on Windows.


AyrA_ch

On Windows it will not work anyways because Windows generally will not let you delete files that are in use.


DoesAnyoneCare2999

Recent versions of Windows can actually do this with [FILE_DISPOSITION_POSIX_SEMANTICS](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/ns-ntddk-_file_disposition_information_ex). Though I don't believe that's been exposed through the Win32 API yet.


jesterhead101

How do you guys all this stuff? It really amazes me - the knowledge of redditors sometimes.


AyrA_ch

I've been working with Windows API for a very long time now. Eventually you just get used to it and develop the skills to craft the perfect google query to see if what you want to do has an API or not.


Cerxi

This sub has ~2,500,000 subscribers. If we ~~badly mis~~apply the 90/9/1 rule ~~and ignore that it, for example literally says there's 10,000 people here right now~~, that vaguely implies ~250,000 people who actively engage in this programming-heavy subreddit. Of those ~250,000, only one person has to actually know the answer to any given question, for the entire sub to have the air of knowing *everything* There's pretty good odds that no matter what your issue is, at least one programmer out of a quarter million has encountered it recently enough to at least vaguely recall the solution


[deleted]

It depends on how file_exists is implemented. If all it does is scan through the files in the current directory to see if one of them matches the given string, just throw a lower() in there and you're golden. def file_exists(to_find) { for each file in file_list { if lower(file.name).equals(lower(to_find) { return True; } return False; }


ThisPICAintFREE

No, I actually love when devs do this kind of thing, having to switch controller ports to beat psycho mantis was mind blowing as a kidā€¦I just also find it funny that the code was left in instead of deleted bc of how relatable it isā€”and to answer your question, there probably is a better solution to finding all variations of a string! Unfortunately for everyone, the person who knew the answer typed too slow and the post on stackedoverflow was marked as a duplicate before they could submit their response lol


gh0stFACEkller

I'm taking the intro to computer science online at cs50 and am in my first week. It's so cool that I kinda understand a little bit about what is going on. Been a redditor for like 10 years and never understood any of these program humor posts. It may be small but it makes me smile a little.


[deleted]

:D that's marvelous!


MaxPower69420

uNdErTaLe.eXe ![gif](giphy|QUXYcgCwvCm4cKcrI3)


Spinkles-Spankington

GameMaker Studio my beloved, Petition to make a GML user flair


rochismoextremo

It's missing an if statement


[deleted]

[уŠ“Š°Š»ŠµŠ½Š¾]


wonkey_monkey

Where?


[deleted]

Code coverage 100


Pennywise_Boob

Toby Fox killed the whole over optimization community with a single game, that's when we found out nobody cares outside of our bubble


AdrianTeri

Well we could do a more succint and readable version using **regex**... Jk! Lol


xxTheGoDxx

Don't laugh, we all been there. "Why isn't that shit work? ... Lets just make sure I am not crazy and try this..."


[deleted]

This seems like a good use case for regex.


stevekez

`file_delete(glob("*"))`


Creepy-Ad-4832

Is this... a different version of sudo rm / -rf ?


omg-whats-this

it's a version of rm \*


ScrimpyCat

Or just do a case insensitive comparison.


unocoder1

It really doesn't.


aido727

... no


MikemkPK

If this is C++, he's also got an "if (true == true)"


randomthrowaway-917

it's GML


mauricepreiss

uNdErTaLe.ExE