Science

Coders Assimilate Donald Trump to a Programming Language

Two computer science students "Make Python Great Again," and, in the process, troll Trump beautifully.

Getty Images (Photo Illustration, Inverse)

Sam Shadwell and Chris Brown are junior computer science majors at Rice University. Last weekend, they participated in HackRice, a hackathon. Sam and Chris, together with Dan Korn and Cannon Lewis, spent the first day brainstorming, their first evening drunk-brainstorming, and then coded for a total of 20 hours.

The end result? TrumpScript, a version of the programming language Python, that is designed to act like Donald Trump. And, of course, to “Make Python Great Again.”

On their GitHub page, Sam and Chris list some of TrumpScript’s features:

No floating point numbers, only integers. America never does anything halfway.
All numbers must be strictly greater than 1 million. The small stuff is inconsequential to us.
There are no import statements allowed. All code has to be home-grown and American made.
Instead of True and False, we have fact and lie.
Only the most popular English words, Trump’s favorite words, and current politician names can be used as variable names.
Error messages are mostly quotes directly taken from Trump himself.
All programs must end with “America is great.”
Our language will automatically correct Forbes’ $4.5B to $10B.
In its raw form, TrumpScript is not compatible with Windows, because Trump isn’t the type of guy to believe in PC.
The language is completely case insensitive.

Basically, every programming language has a set syntax, just like English has a set syntax. Python is different from C++, which is different from Java. TrumpScript, then, is a version of Python that replaces some of the common syntax with Trumpian phrases, numbers, and logic. (“Logic.”)

Chris Brown and Sam Shadwell.

Chris Brown and Sam Shadwell

Inverse spoke with Sam and Chris about the process of creating this national treasure.

What inspired you to write this language?

Chris: I was trying to push a Chrome extension that would, like, change words to make it sound like Trump, alter pictures to either be of Trump. I was really pushing using Google Deep Dream, training it on pictures of Trump.

Sam: That morning I had watched that weird, that strange video that’s like “The Trump Song,” or something? It made me uncomfortable. And I was like, ‘Man, that’s really weird. Boy, I would love to just satirize this guy.’

I think I know the answer to this question, but, just for the record: How do you feel about Donald Trump?

Sam: Well. Boy. I think he’s a…swell guy. No. I’m a little bit worried at the state of American politics if he is actually, legitimately, a front runner in the GOP.

"ERROR_CODES are the different errors we output if they try various things we don't allow. Most of them are Trump quotes"

What about TrumpScript makes you most proud?

Sam: I kind of like the way that it works — if it actually worked, completely, which it…doesn’t —

Chris: There’s some stuff — I’m working out some kinks.

Sam: I’m most proud that the language itself is actually parsed and compiled in a way that sort of resembles how a real compiler would compile a real language.

Chris: In what I would consider proper TrumpScript style: 80 percent of the words you write should probably get dropped by the compiler and be completely unnecessary to the program.

"ExampleScriptToOutput shows a more complex bit of TrumpScript at the top after the first 'cat' command, and then its corresponding output below that (after the 'TRUMP' command)."

Is there anything you wish you could’ve incorporated?

Sam: I’m very surprised that this has gotten the amount of attention that it has. But, I really want it to just kind of fit the spec more closely than it does. But, there are tons of people who are putting all these requests on GitHub and saying, like, ‘Oh, man — you should, like, make this joke a feature, and this other joke a feature…’

"OSandLocaleCheck is where we check to make sure they aren't in China or Mexico."

Chris: And we’re just like, uh, maybe we can get it to work the way it’s supposed to, first.

On that front, though, people on GitHub have actually had some pretty good pull requests for adding features. Someone grabbed the locale module in Python, they imported it, and so then now it checks locales, and if you’re in, I think, China, at the moment, or Mexico, the compiler will just quit and say ‘No.’

Sam: You can disable that…but you have to know where to look.

Were you aware of any similar projects? My brother told me about Like, Python, which does what TrumpScript does but with Valley girl–speak.

Sam: I wasn’t, really — I knew that languages like that existed. The one that I knew about was Brainfuck, but that’s pretty different. Somebody told us about ArnoldC, which is just Arnold Schwarzenegger quotes. But we got the idea before — we started talking to other people about our idea, and then somebody was like, ‘Oh, I’ve heard about this thing called ArnoldC that does something similar.’ And then all these other ones, like Like, Python. Other people have mentioned C+=. I had not heard of these, not until after.

How long did it take? It was a hackathon, so it must’ve been pretty quick, right?

Sam: Timeline’s a little interesting. So, the hackathon was 36 hours, and we started it, and the first night we said, ‘You know, we really should get more ideas for what we want the language to do’ — or, probably more accurately, ‘to not do.’ And so we actually kind of went back and got drunk that first night…and didn’t write any code. But, we brainstormed. We had a brainstorming session.

Then, the next day, we actually started after we woke up. And I think it was probably about 19…hours?

Chris: I’d say 19 or 20 hours of actual coding.

"RunningSpanish is similar to ExampleScriptToOutput, it shows what happens if you try to run a script that has Spanish in it (which has a fun message post-translation) and then the error message at the bottom."

Is homework now taking a backseat, what with all the buzz you guys are getting?

Chris: Actually, I’m taking Programming Languages right now, and this is basically a harder version of the homework I have to do sometime this week. We’re about to have to be doing a recursive descent parser for some toy language, which is more logical and reasonable to write than this language — which is extra confusing.

So you’ll get extra credit, maybe?

Chris: Probably not.

Are you working on anything else exciting?

Sam: Oh, boy. I don’t know. Right now we’re kind of taken aback. This was just like a, ‘Oh, this would be a funny project for this hackathon!’ So we’re just kind of taken aback at, like, what’s going on right now.

Chris: I haven’t thought that far ahead in the future yet.

Interview has been edited for clarity and brevity.

Related Tags