Science and technology

Write a cute program with Emojicode

In this text, I’ll cowl the best coding language to discover ways to make something! It’s referred to as Emojicode. Created in 2014 by Theo Belaire, Emojicode is an open supply programming language that makes use of emoji characters to signify its syntax. When working in Emojicode, emoji are used to create variables, features, and management buildings. Because it is a statically typed language, variable varieties have to be declared earlier than use, nevertheless it additionally helps object-oriented ideas like lessons and inheritance. This language will be run on each OS, and it is a tremendous enjoyable strategy to code, particularly in case you’re a non-native English speaker. This is useful as a result of pictographic representations can carry us all collectively and permit us to talk the identical language in a approach just like math.

Prerequisites

In this tutorial, I’m utilizing a Debian-based OS. My instruments could also be totally different than what your OS might require. Here’s what I’m utilizing:

  • Geany, an open supply IDE for Linux.
  • IBus, which lets you choose emoji and place them in your editor. The interface I’m utilizing known as emoji picker.
  • Debian-based Linux.
  • A C++ compiler. I’m utilizing the g++ compiler.
  • Emojicode

I’m utilizing a Linux OS, however you’ll be able to read the docs to find out about any particular steps you would possibly have to take to apply it to one other OS.

Intall Emojicode on Linux

There are a pair methods to put in Emojicode in your laptop, however they’ve a cool magic install page that may let you know precisely what to do. Here’s what I did:

$ wget https://github.com/emojicode/emojicode/releases/download/v1.0-beta.2/Emojicode-1.0-beta.2-Linux-x86_64.tar.gz -O emojicode.tar.gz 
&& tar -xzf emojicode.tar.gz && rm emojicode.tar.gz 
&& cd Emojicode-1.0-beta.2-Linux-x86_64 && ./set up.sh 
&& cd .. && rm -r Emojicode-1.0-beta.2-Linux-x86_64

This is the output of that command.

(Jess Cherry, CC BY-SA 4.0)

Now that you’ve all the things put in, it is time to transfer on to some code!

How does this complete factor work?

To begin, all Emojicode file extensions finish in filename.๐Ÿ‡ however as a result of you’ll be able to’t try this in your common file identify, it interprets to filename.emojic. Here are crucial syntax parts:

  • Put ๐Ÿ in the beginning of a line to point what blocks of code are supposed to be executed
  • Start a block of code with ๐Ÿ‡
  • End a block of code utilizing ๐Ÿ‰
  • Want to print one thing? Just use ๐Ÿ˜€ ๐Ÿ”ค <string> ๐Ÿ”ค โ—

There’s far more to it, so listed here are some sensible examples.

Print a haiku

First up, attempt printing a pleasant haiku for enjoyable! I’ll add a single remark on this instance. See in case you can determine it.

๐Ÿ๐Ÿ‡
๐Ÿ’ญ This is a single line remark for enjoyable
๐Ÿ˜€ ๐Ÿ”คEmojicode is nice,๐Ÿ”ค โ—
๐Ÿ˜€ ๐Ÿ”คFun and expressive code,๐Ÿ”ค โ—
๐Ÿ˜€ ๐Ÿ”คno disappointment, simply pleasure.๐Ÿ”ค โ—
๐Ÿ‰

Now we have to save our code and run it via our compiler to make a pleasant executable file:

$ emojicodec haiku.emojic 
$ ls
haiku  haiku.emojic  haiku.o

As you’ll be able to see, the code has been compiled and generated two recordsdata, one in every of which is executable. Run the haiku file:

$ ./haiku 
Emojicode is nice,
Fun and expressive code,
no disappointment, simply pleasure.

Programming and growth

Math and variable manipulation

Next up, you are going to do a few issues without delay: slightly little bit of math and the altering of the variable. Start by assigning a variable to 0:

0 โžก๏ธ ๐Ÿ–๐Ÿ†•x

You simply created a brand new variable by utilizing the crayon emoji, and the brand new emoji subsequent to the variable identify, whereas additionally assigning that variable to 0.

Next, print a line that features the variable utilizing the magnets emoji:

๐Ÿ˜€ ๐Ÿ”คThe worth is ๐Ÿงฒx๐Ÿงฒ ๐Ÿ”ค โ—

Next, change the variable utilizing the plus signal and arrow emojis:

x โฌ…๏ธโž• 1

Then print one other line with the worth. I proceed this for some time and print the ultimate worth. Here’s what I did:

๐Ÿ ๐Ÿ‡

๐Ÿ’ญUpdating a variable utilizing math 
0 โžก๏ธ ๐Ÿ–๐Ÿ†•x
๐Ÿ˜€ ๐Ÿ”คThe worth is ๐Ÿงฒx๐Ÿงฒ ๐Ÿ”ค โ—

x โฌ…๏ธโž• 1
๐Ÿ˜€ ๐Ÿ”คThe worth is ๐Ÿงฒx๐Ÿงฒ ๐Ÿ”ค โ—

x โฌ…๏ธโž• 15
๐Ÿ˜€ ๐Ÿ”คThe worth is ๐Ÿงฒx๐Ÿงฒ ๐Ÿ”ค โ—

x โฌ…๏ธโž– 9
๐Ÿ˜€ ๐Ÿ”คThe worth is ๐Ÿงฒx๐Ÿงฒ ๐Ÿ”ค โ—

x โฌ…๏ธโž— 2
๐Ÿ˜€ ๐Ÿ”คThe remaining worth is ๐Ÿงฒx๐Ÿงฒ ๐Ÿ”ค โ—
๐Ÿ‰

Next, compile the code utilizing emojicodec, after which use your executable code to see the end result:

$ emojicodec math.emojic 
$ ./math 
The worth is 0 
The worth is 1 
The worth is 16 
The worth is 7 
The remaining worth is 3 

As you’ll be able to see, all the things printed out because the variable was up to date with the brand new math. You can take this even additional with the numerous mathematic emojis out there. Here are just some extra operators:

๐Ÿšฎ is your modulo
โ—€ Less than
โ–ถ Greater than
โ—€๐Ÿ™Œ lower than or equal to
โ–ถ๐Ÿ™Œ larger than or equal to

Programming and growth

Emojicode quirks

While I used to be bouncing across the docs, I discovered some attention-grabbing quirks. One of these is that whereas grabbing enter from a person, the pores and skin tone of the ear issues resulting from some identified compiler subject.

The motion for getting person enter is that this:

๐Ÿ†•๐Ÿ”กโ–ถ๏ธ๐Ÿ‘‚๐Ÿผโ—๏ธ

The motion for getting and assigning person enter is that this:

๐Ÿ†•๐Ÿ”กโ–ถ๏ธ๐Ÿ‘‚๐Ÿผโ—๏ธ โžก๏ธ inputText

I used to be trying to get that to work however was having some points with my compiler when I discovered that. You can also run into some small issues right here and there. If you do, make sure to create an issue, so it has an opportunity of being mounted.

No methods, simply nice code

While I may undergo a lot extra, I can guarantee you the docs behind this superb code are very intensive. Even although I used to be impressed to jot down this text only for enjoyable in time April Fool’s Day, I’ve to confess this is without doubt one of the greatest languages ever made as a result of it teaches you numerous about very actual programming ideas. I earnestly recommend this as a enjoyable strategy to educate a few of your pals, children, or possibly a classmate, who’s excited about coding. Hopefully, you may have a fun-filled April Fool’s Day!

Most Popular

To Top