Emojicode
If unable to view some emoji below, your operating system might not be the latest. Rather than update your operating system just for this test, try viewing this page on your phone or another computer instead, albeit in accordance with the courseโs policy on academic honesty.
Odds are youโll have to teach yourself a new programming language some day, perhaps even installing some software for it. Letโs prepare you for that day!
Emojicode is โan open-source, full-blown programming language consisting of emojis.โ Here, for instance, is a now-familiar program, implemented in Emojicode:
๐ ๐
๐ ๐คhello, world๐คโ๏ธ
๐
Installing
In order to compile that program from Emojicode to machine code, youโll need a compiler, emojicodec
. Hereโs how to install it VS Code:
-
Install some โdependenciesโ that Emojicodeโs compiler requires:
sudo apt install -y libncurses5 rsync
-
Download a โgzipped tarballโ (which is similar to a Zip file) of Emojicodeโs installer:
wget https://github.com/emojicode/emojicode/releases/download/v1.0-beta.2/Emojicode-1.0-beta.2-Linux-x86_64.tar.gz
-
Decompress that gzipped tarball:
tar -xzf Emojicode-1.0-beta.2-Linux-x86_64.tar.gz
-
Change into the decompressed directory:
cd Emojicode-1.0-beta.2-Linux-x86_64
-
Run the installer therein:
sudo ./install.sh
And answer
y
to any questions when prompted.
If you then run
emojicodec
without any command-line arguments, you should see:
๐ Option 'file' is required
If not, best to retry these steps!
Compiling
Execute
code hello.๐
to create a new file called hello.๐
. (Youโll probably find it easier to copy/paste than type manually.) Thatโs right, Emojicode uses a file extension of .๐
!
Next, copy/paste this now-familiar program into the file:
๐ ๐
๐ ๐คhello, world๐ค โ๏ธ
๐
Then compile the program with:
emojicodec hello.๐
And run it with:
./hello
You should see a familiar greeting. If not, best to retry these steps!
Understanding
To understand this new language, start by reading Emojicodeโs guide. Then answer each of the below.
- (1 point.) What is ๐ similar to in C?
- (1 point.) What are ๐ and ๐ similar to in C?
- (1 point.) What is ๐ similar to in C?
- (1 point.) What are ๐ค and ๐ค similar to in C?
- (1 point.) What is โ๏ธ similar to in C?
Keeping Emojicodeโs guide still in mind, consider the program below. You might find it helpful to copy/paste it, too, into a .๐
file so that you can compile and run it a few times.
๐ ๐
๐ฟ 1 2 3 4 5 6 7 8 9 10 ๐ โก๏ธ ๐๏ธ๐ numbers
๐น numbers โ๏ธ
๐ ๐ก ๐ฝ numbers 0 โ๏ธ โ๏ธ โ๏ธ
๐
- (2 points.) In
emojicode/6.py
, re-implement the program in Python.
Letโs now stray a bit from the guide. Consider the program below. You might find it helpful to copy/paste it, too, into a .๐
file so that you can compile and run it. You might also find it helpful to skim Emojicodeโs package index for strings.
๐ ๐
๐ ๐ค๐คท ๐คโ๏ธ
๐ ๐กโถ๏ธ๐๐ผ โ๏ธ โก๏ธ s
๐ ๐ค๐ ๐ค โ๏ธ
๐ s โ๏ธ
๐
- (2 points.) In
emojicode/7.py
, re-implement the program in Python.
Finally, consider the program below. You might find it helpful to copy/paste it, too, into a .๐
file so that you can compile and run it. You might also find it helpful to skim Emojicodeโs language reference for control flow.
๐ ๐
๐ i ๐โฉ 10 0 -1 โ๏ธ ๐
๐ ๐กiโ๏ธ โ๏ธ
๐
๐
- (2 points.) In
emojicode/8.py
, re-implement the program in Python.