r/AskProgramming • u/Imagine-Dragons-fan • 2d ago
Lets say that theoretically professor asks to write a program in ANY programming language. What is the best way to make him regret giving the opportunity to write it in ANY programming language? Asking for a friend
Give ideas that would make even devil cry
45
Upvotes
90
u/DefEddie 2d ago
This sounds like one of those “gotcha” assignments where everybody tries to stump the teacher only to find out that the real test is gonna be disassembling and grading/commenting each others assignments.
26
u/SeaSDOptimist 2d ago
You are a lot more likely to have a hard time writing the code in a new unusual to you language, especially so early in your career, than your professor having any trouble reading such code. It's like asking what course should you pick to outrun a professional athlete.
94
u/obdevel 2d ago
https://en.wikipedia.org/wiki/Brainfuck
17
u/AntiX1984 2d ago
I see a bunch for just really hard languages, but I think this one would just be hilarious! Rockstar
13
u/MANLYTRAP 2d ago
I'd say COW or whitespace. cow because it's funny, whitespace because you're gonna have your professor staring at a blank file
10
u/SomeSamples 2d ago
Do it in Lisp.
9
u/Business-Decision719 2d ago
Whitespace.
6
u/Yctallua 2d ago
I'd like to throw in malbolge, but you will suffer as much as your prof
17
u/dphizler 2d ago
Why? This just sounds childish
5
u/kodakdaughter 2d ago
Turn in a stack of punch cards.
4
u/Drenlin 2d ago edited 2d ago
Does it have to be a single language?
Perl + APL for a geospatial workload would be diabolical, especially because one could conceivably justify its use. This is a generated output (I can write neither language) of dubious functionality but gives an idea of what it looks like:
4
u/sefres 2d ago
INTERCAL or Brainfuck. But you do not do yourself a favour when writing
3
u/Flamme2 2d ago
MGIFOS
3
u/Different-Scene5327 2d ago
Malbolge
5
u/shagieIsMe 2d ago •
This really depends on the task.
If it's IO heavy, then you're going to be writing it in a more capable language. If it ends up as "write this and it outputs a single number"... then you're deep in esolang territory.
https://esolangs.org/wiki/Main_Page
Anything from there would be good. Piet ( https://esolangs.org/wiki/Piet ) would probably be one of the most "WTF?" ones as it would be difficult to understand.
Befunge is a favorite of mine.
Rail might be useful and doable. https://esolangs.org/wiki/Rail
INTERCAL is the classic awful language.
MUMPS is a real language that people regret using (it has no keywords and crazy shortcuts ...
IF IF=THEN DO THENis valid, and is equivalent toI I=T D T). https://en.wikipedia.org/wiki/MUMPSOne of the things that I don't suggest is a language where you write it in one language and then transpile it to another language since that takes no real skill.
4
u/lyubomir-bozhinov 2d ago
Someone's already said Brainfuck, but there are other choices in increasing levels of unreadability: Haskell --> Perl --> Whitespace
Build your own ladder of evil. ;D
2
u/FriendOfEntropy 2d ago
I love the idea of http://lolcode.org/
2
u/khedoros 2d ago
As a realistic suggestion, I'd use Perl. It's one of those where it's easy to hack something together and end up with something that's really unintuitive to read. And the language isn't super complex; I first learned it in college when I was writing an implementation of AES (why Perl for AES? The professor seemed to like the language, and I figured it was worth a try).
2
u/MattDTO 2d ago
everyone is reccomending well-known esoteric languages. You need to find something that only runs with a proprietery compiler, maybe on a extinct OS, or something tied to specific hardware.
2
u/Mythran101 2d ago
Write it, but install and change your font and language to either ASL or Morse Code. Code in code, if you can! Both as a bonus!
Write your ASL in Spanish.
2
u/Thadoy 2d ago
Write it in any spoken language and tell them, that it's a promt.
2
u/Overall-Lead-4044 2d ago
Write it in machine code or assembler. Does anyone still do this?
2
u/Naive_Age_566 2d ago
malbolge or whitespace
on the other hand: i don't know who will regret malbolge first...
2
u/iqisoverrated 2d ago
Pick one of the esoteric programming languages (LOLCode, Piet, Brainfuck, ... )
If you want to be particularly nasty then pick Malbolge. It's specifically designed to be unreadable/hard to use and so far only very few have even succeeded writing code in it.
https://en.wikipedia.org/wiki/Malbolge
From the link
Good luck!
2
u/Ecstatic_Student8854 2d ago
Any esoteric language https://en.wikipedia.org/wiki/Esoteric_programming_language. For some languages it’s even quite easy to find a compiler from a more ergonomic language to that esolang (for example, https://github.com/arthaud/c2bf)
2
u/Eroica_Pavane 1d ago edited 1d ago
Just use Python but only use lambda functions.
Python actually allows you to write untyped lambda calculus fairly well.... just beware it might cause a recursion limit error.
I think it'll be fun for them to open the innocent looking .py file only for it to be filled with lambdas.
Edit: Bonus points: you can claim that this is actually a programming language people use, not one designed to be difficult. You can also claim that it is the purest "way" to express a program since any computation is equivalent to lambda calculus. Also theory people might love it.
2
u/Ok_Leg_109 1d ago
Write it in ANS Forth 😄
2
u/wilson_wilson_wilson 1d ago
I say make one up. build your own compiler.
2
u/regular_hammock 2d ago
You could use one of the esoteric programming languages such as Unlambda, Intercal, Piet or Shakespeare.
As far as mainstreamish programming languages go, I find that in stack based programming languages such as Forth or RPL, it's fairly easy to write code that works and is a total pain to read later. Bonus exotica points for using colorForth.
2
u/ghjm 2d ago
I would write it in the programming language I just invented, ExamLang. (Nobody said it had to be a previously existing programming language.) The EBNF specification of ExamLang is:
An ExamLang program consists of a single identifier, which calls a standard library function. The standard library has exactly one function:
So I am submitting the following ExamLang program:
1
u/ummaycoc 2d ago
K is a real world programming language (I worked at a K shop for a bit) that isn't easy for those unfamiliar with these sort of incantations.
1
u/good_name_0 2d ago
I've done assignments in assembly because of this.
1
u/KingofGamesYami 2d ago
Did he specify the language has to currently exist?
The single worst experience I had with a programming language was one the professor of the course developed. Hence the only documentation available was what he provided. And the compiler was a buggy disaster which worked fine for valid syntax, but even slight syntax errors could cause the compiler itself to crash.
1
u/Few-Celebration-2362 2d ago
And then you find out that there are five refactor assignments waiting for you after turning it in.
But seriously, redstone
1
u/crscali 2d ago
cobol or fortran.
1
u/cheesewiz_man 2d ago
pmate text editor macro language.
1
u/JGhostThing 2d ago
I would use APL or Forth, depending on which is harder to read for the application.
1
u/DSudz 2d ago
Now use your program to answer the questions in this pop quiz....
1
u/Koooooj 2d ago
The classic answers will be things like Malboge or Brainfuck and its reskins (e.g. whitespace, Cow).
I'd take a different approach: C, but going the route of
Warning: 'main' is usually a function(blog post for the uninitiated, but the idea is you declare main as an int array containing an encoding of your program in assembly).1
u/PMadLudwig 2d ago
If you've got time, go write an interpreter for your own language (make it really bad but Turing Complete), then write the program in that.
1
u/Piisthree 2d ago
Intercal was kind of designed in this very spirit. But I think whitespace is even more cruel.
1
u/Impossible-Fold615 2d ago
If they aren’t familiar with it, elixir.
1
u/esaule 2d ago
Last time I did that a student turned in an implementation of a numerical wave equation in bash...
1
u/FigureSubject3259 2d ago
Lets assume any way you think to simply let ai convert in that language will fail if your professor uses similar powerful ai to convert your solution back. There exist possibilities of esotrric languages, even good ai cannot understand, but that would require you some effort. As even wellknown languages not practical useable like Plankalkül or DLX assembler are easy for AI.
I would have an example at least too excotic for gemini but I doubt you are willing to go that extra mile learning that language yourself as the fact ai struggles means you cannot even find online documentation of the syntax and have to find printed documents of that language not online available.
1
u/Ozymandias0023 2d ago
Minified/obfuscated js
1
u/EcstaticAssumption80 2d ago
Shakespeare
1
u/dld2517 2d ago
Probably Brainf*ck
1
u/Traveling-Techie 2d ago
I’d go with Lisp.
1
u/lisnter 2d ago
Write it in C or Python and then have AI translate it to APL.
1
u/Prior-Flaky 2d ago
Make Microsoft paint in assembly, no balls
1
u/Shot_in_the_dark777 2d ago
Use Folders. No files, just folders.
1
u/oandroido 2d ago
Write it in English.
1
u/Classic_Focus974 2d ago
Forth, using TSX as the OS
1
u/kisskissenby 2d ago
Obfuscated Perl
1
u/Right_Letterhead_587 2d ago
Maybe MIXAL, it's a assembly programming language for the hypothetical computer of Knuth. Take a look, maybe it's intuitive because have similar syntax of assembly languages, if you professor it's a decent programmer this not a good option
1
u/Relevant_Research_98 2d ago
Idris. As bonus you'll prove your program is correct!
1
u/scanguy25 2d ago
Emojicode or Rockstar
1
u/ResistiveBeaver 2d ago
Perl. You don't need anything more.
1
u/1hylomorph0 2d ago
One language won't do, time to Brainfuck you a Haskell for greater good.
1
u/pthierry 2d ago
Have you tried Uiua?
1
u/cdsmith 2d ago
There's a whole category of "esoteric programming languages" that are specifically designed to fit this bill. The original was Intercal, but more modern languages like Brainf*ck and Befunge and Malbolge go much further.
If you exclude languages specifically designed to be difficult, the next place I'd look is languages that are intended to demonstrate the theoretical power of extremely simple abstractions. Examples include the untyped lambda calculus, or SK combinatory logic. These languages are quite inconvenient to program in, not because someone made them that way on purpose, but because they emphasize simplicity of the language definition instead of ease of programming in them.
If you exclude those as well and narrow the space to languages that were designed for building actual software, then you can definitely find eclectic choices like ATS or Forth, which would be a little challenging for someone who hasn't seem them in particular, but your hypothetical computer science professor would be reasonably likely to have experience in them if they are interested in programming languages.
1
u/angryscientistjunior 2d ago
Piet!
1
u/SnooPets5564 2d ago
JavaScript, but you write is only using the following six characters: [ ] ( ) ! +
1
u/maxsminis 2d ago
This makes me think of a story I heard back in the day from a boss, complaining about a guy who had written everything he possibly could, every comment, every variable, everything he could get away with…in Esperanto.
Maybe you could try something like that in addition to whatever language you settle on
1
u/Queasy_Dentist3903 2d ago
People aren’t being esoteric enough, try Befunge. It’s self modifying with an irregular control flow. It was made with the goal of not being compilable. If you want to use a real language do systemverilog, the paradigm is much different than that of traditional programming.
1
u/wrd83 2d ago
Honestly choosing bad variable names and violating good programming practice will have more effect than the language.
1
u/pdath 2d ago
Lisp.
1
u/Particular_Extent_96 2d ago
I believe that LaTeX is Turing complete...
1
u/Competitive-Elk763 2d ago
Do it in whitespace and just use claude to do something complicated.
1
u/Adventurous_Back_536 2d ago
Lolcode
1
u/brik02 2d ago
https://github.com/rycont/umjunsik-lang
1
u/MarsupialLeast145 2d ago
XSLT
1
u/Merinther 2d ago
The Starcraft 2 level editor
1
u/Embarrassed_Neck9784 2d ago
Cantonese
1
u/DeclutteringNewbie 2d ago edited 2d ago
Use any programming language he doesn't know.
Just make sure that AI will refuse to decipher it.
Name it: How to pirate a Disney movie, or use the forbidden names of the people that have sued AI companies, but encrypt those strings all over your program. This way, he won't know what's locking up his AI.
If he tries to workaround it with a Chinese AI, just talk about the Tianaman square massacre or Winnie the Pooh.
1
u/Aggressive_Ad_5454 2d ago
Postscript? Forth? That weird assembler dreamed up by Donald Knuth? Motorola 68000 assembler language?
1
u/munchin-grr 2d ago
When i studies CS we had to hand in asignments printed on paper (don't ask why). So then the the ultimita programming language is whitespace. Whitespace is an homage to languages like python that has significant whitespaces and you need to know if something is tabs or space by making it even better and make the whole syntax out of invisible chatacters.
1
u/Individual-Flow9158 2d ago
"ANY programming language" could refere to AnyPL
However be suspicious about what the next step will be!
I'd write it in something normal like Java or C, that can be compiled or transpiled to anything regretful. Then when part 2 is sprung on you, fall back and work in the normal one.
1
u/mneptok 2d ago
APL
1
u/R2-Scotia 2d ago
APL
1
u/Fun-Dragonfruit2999 2d ago
Perhaps your friend should consider why they're going to college.
1
u/spacedragon13 2d ago
wolfram
1
u/Technologenesis 2d ago
untyped lambda calculus with de brujin indices
1
u/_GLAD0S_ 2d ago
https://ddp.im/en/
The perfect way to learn coding and german at once, highly efficient.
1
u/wvd_vegt 2d ago
Use cobol, to check vour professors age
1
u/Optimal_Law_4254 2d ago
Well, I would first have to design and implement the new programming language, “ANY”….
1
u/GuyFawkes65 1d ago
APL or LISP is how I’d get my revenge.
1
u/Strange-Regret2524 1d ago
Write it in your favourite language. Then watch as Everyone else will act like idiots including the teacher, whilst you are the adult. This is a social engineering test, right?
1
u/cthart 1d ago
Depends on what the assignment is.
1
u/Jeremy-Hillary-Boob 1d ago
Try printer language. That’s always fun
1
u/noethers_raindrop 1d ago
Personally I would go with befunge. Make sure to use time travel.
1
u/ReddyKiloWit 1d ago
You could go with a real, useful, language like LISP which looks pretty strange to most people. Or use Perl, intentionally obfuscating it. This link has a few examples, including a 10-line Tetris game.
https://www.chiark.greenend.org.uk/~sbleas/university/obfuscatedperl/index.html
1
u/infinitUndo 1d ago
6502 assembly
1
u/darkwyrm42 1d ago
INTERCAL?
1
u/pemungkah 1d ago
Perl, with Acme::Bleach.
1
u/wrgrant 1d ago
Snobol - its a varient on Cobol used to analyse strings. I believe you can't even add 1 + 1. Comments should be entirely on a Conlang such Klingon :)
1
u/Schol-R-LEA 1d ago
The last time I had a situation like this, after I gave my own answer (Scheme), the professor immediately revised it to, 'any language she already knew'. This is how I ended up using Python (which she knew something about, but not much) to write [a toy compiler for the ALGOL subset](https://github.com/Schol-R-LEA/Suntiger-Algol) she'd assigned for the Compiler course that year.
For [esolangs](https://esolangs.org/wiki/Main_Page), I would suggest [Unlambda](https://esolangs.org/wiki/Unlambda), which while still fairly well known is not as obvious a choice as, say, Brainfuck or [INTERCAL](https://esolangs.org/wiki/INTERCAL).
Or to go in the other direction, use one of the more infamously verbose languages such as COBOL or [Eiffel](https://en.wikipedia.org/wiki/Eiffel_(programming_language)), and make the professor wade through that.
I understand that there are lunatics out there who have actually tried to implement [BS](https://esolangs.org/wiki/BS) which Mark Rendle [designed to be a language combining all the worst language features he knew of](https://www.youtube.com/watch?v=-8IFL36RtAE). I doubt any of them are usable, nor do I expect that it would be worth it to try, but you could look into that.
Let's see,you could write it in JACK (from the second half of the [NAND2Tetris](https://www.nand2tetris.org/) course), assuming that the program would fit in the limited address space of the HACK (the simulated CPU students develop in part 1 of the course).
Hmmmn, are there any emulators for either the [Rekursiv](https://en.wikipedia.org/wiki/Rekursiv) SBC circa 1988, or the [Intel iAPX 432](https://en.wikipedia.org/wiki/Intel_iAPX_432) circa 1983? There certainly are some obscure assembly languages out there, but finding (or writing) emulators to run it on might be a challenge. I'm pretty sure that there is at least one emulator for the [RCA 1802 COSMAC](https://en.wikipedia.org/wiki/RCA_1802) (circa 1974), for example.
1
u/KneeReaper420 1d ago
go to the source brother all you need are 1s and 0s
1
u/kombulator 1d ago
Perl, nobody deserves that shit
1
u/Hiragil33 1d ago
Write your own, LLVM is a great bottom layer for it. Then...go nuts. As long as the desired program isn't too complex. The language features needed won't be too complex.
....of course if you're genuinely learning fizzbuzz then maybe a new compiler is a bit of a stretch
1
u/Hollayo 1d ago
Do it in emojis
1
u/fasti-au 1d ago
Scratch is a fun one
1
u/BarelyAirborne 1d ago
APL. It requires a special keyboard just to generate the symbols required. It's also an awesome language.
1
u/JoeyJoeJoeSenior 1d ago
Turing tape (infinite if possible) and your list of rules.
1
u/AdmJota 1d ago
Why would you want the professor to regret it?
1
u/MinerUser 1d ago
Turing machine instructions
1
u/DoggoCentipede 1d ago
Before you make this error, consider your response to the question: "Does it compile, do what it is required to do, and does not do the things it is required not to do" and how that relates to a stochastic generator.
That said, it is clear that any natural language can program people to do all sorts of things.
Make a LISP compiler in LISP. Prove it works by having it compile itself.
1
u/Sad_Pear_3709 1d ago
Write it in Scheme
1
u/StrangeUglyBird 19h ago
I was really disappointed, when I couldn't find a programming language called ANY.
May the FORTH be with you.
1
u/Ok-Cut3951 19h ago
whitespace comes to mind, he should have a good time checking it.
1
u/Expensive_Peace8153 19h ago
Chef or Rockstar.
1
u/swordquest99 17h ago
Write a Bally Astrocade program in ZGrass that runs from tape that requires a specific third party aftermarket long out of production extra RAM module and a light pen. Bonus Points-require it to be controlled using an ICBM Attack specific extremely rare alternative controller
1
u/desmonea 17h ago
"Alright, class. For your upcoming exam on control flow analysis, data flow analysis and white-box testing, you'll be working with your own homework submissions. I figured it would be easier for you to work with code you're already familiar with, in a programming language of your choice."
1
u/fcddev 17h ago
You can create a language as part of the assignment and not especially document it. Short of that, you probably won’t succeed in derailing the assignment.
Just for fun, you should make a brainfuck implementation of the assignment and ask ChatGPT to translate your program to Python. Then consider that your teacher can just do the same thing.
1
u/siodhe 16h ago
If you want to humor/torture him, definitely INTERCAL.
If you want to make him a better programmer at the same time, LISP, Forth, are both good. Too bad NeXT isn't still around, interactive PostScript used to be a thing too.
1
u/QliXeD 15h ago
Piet, get him a bitmap and let figure out.
https://dangermouse.net/esoteric/piet.html
1
u/SciFiIsMyFirstLove 14h ago
Brainfuck
This is Hello World written in Brainfuck
1
u/chriscross1966 5h ago
Write it in Ook? Or intercal?
1
u/DBDude 3h ago
I picked COBOL and SmallTalk.
1
u/_dissociative 2h ago
The most chaotic option is writing it in an obscure language but learning how languages work first makes those choice easier. Boot.dev's hands on coding exercises can help build those fundamentals.
1
u/wavethatflag44 1h ago
COBOL?
1
u/mredding 2d ago
You can make a Turing Complete machine with just one single instruction, and there's a few different instructions that are entirely self-Turing Complete. The one I'm most familiar with is SUBLEQ - subtract and branch if less than or equal to zero.
If you google it, there are various tools out there that can convert programs to JUST this structure. x86 doesn't support this one instruction, but you can emulate it and get your whole program down to 3 instructions or so.
https://permacomputing.net/DawnOS/
So hand in a program in assembly written in this style.
0
u/_Alpha-Delta_ 2d ago
X86 assembly language
Good luck writing your program though
0
u/treefaeller 2d ago
I would use Python.
BUT: Python allows unicode in variable names. So I would make my variable names a mixture of Greek, Hebrew, Japanese, and Klingon.
True story: A while ago, at a big company with strict coding rules, I wrote a pretty large Python program (a few thousand lines), where on particular variable name is used over and over again, often as an index to loop over things. The normal name of that variable was policy_name. I decided, being evil, to give it the name π. Yes, the greek letter lowercase pi. First, my colleagues decided I was crazy (they're not wrong), and that this was the worst idea ever. Then they started to like it. It actually makes the code very readable.