Emojicode

From Hackers & Designers
Jump to: navigation, search

Emoji3.PNG

Emojicode Workshop

Install

Get Emojicode from the USB stick.

  $ cd /Volumes/KINGSTON/Emojicode-0.5.1-Darwin-x86_64
  $ ./install.sh
  $ export PATH=$PATH:$HOME/emojicode/bin
  $ sudo ln -s /Users/mac/emojicode/EmojicodePackages /usr/local/EmojicodePackages

About

Emojicode is an open-source, full-blown programming language consisting of emojis.

Workshop

Please note that lines that begin with $, should be executed with the Terminal and are NOT program syntax. This workshop also assumes you have completed the Emojiterm workshop. The $ should not be pasted in the terminal.

All other code blocks should be considered valid Emojicode syntax.

Create a file.

  $ πŸ“ myprog.emojic

The simplest Emojicode program looks as follows.

  🏁 πŸ‡
  πŸ‰

To save and exit the text editor (nanoπŸ“), first do Cntl+O, and then Cntl+X.

You can run it by first compiling it.

  $ emojicodec myprog.emojic

Running it.

  $ emojicode myprog.emojib

This program is so simple, it doesn't do anything.

The famous "Hello world!" example.

  🏁 πŸ‡
    πŸ˜€ πŸ”€Hello world!πŸ”€
  πŸ‰

Making a variable...first the "frozen" type. Frozen means you can never change it. Here we make a variable called "a"

  🍦 a 10

You can also compare two numbers with this program.

  🏁 πŸ‡
    🍦 a 10
    🍦 b 4
    🍊 ▢️ a b πŸ‡
      πŸ˜€ πŸ”€a is bigger than bπŸ”€
    πŸ‰
  πŸ‰

User input.

  🏁 πŸ‡
    🍦 input πŸ”·πŸ”‘πŸ˜― πŸ”€Ask something here?πŸ”€
    πŸ˜€ πŸͺπŸ”€You said: πŸ”€ inputπŸͺ
  πŸ‰

Convert integers to strings and back.

  πŸπŸ‡
    🍦 a 🍺 πŸš‚ πŸ”€9πŸ”€ 10
    🍊 ▢️  a 0 πŸ‡
      πŸ˜€ πŸ”€a is bigger than 10πŸ”€
      πŸ˜€ πŸ”‘ a 10
    πŸ‰
  πŸ‰

Lists, make an empty list, add a 2 items (China, Nederland) print them in a loop.

  🏁 πŸ‡
    🍦 list πŸ”· πŸ¨πŸšπŸ”‘ 🐸
    🐻 list πŸ”€ChinaπŸ”€
    🐻 list πŸ”€NederlandπŸ”€
    πŸ”‚ str list πŸ‡
      πŸ˜€ str
    πŸ‰
  πŸ‰

Initialize an a list when you create it (this code does the same as what is above.

  🏁 πŸ‡
    🍦 list πŸ¨πŸ”€ChinaπŸ”€ πŸ”€NederlandπŸ”€πŸ†
    πŸ”‚ str list πŸ‡
      πŸ˜€ str
    πŸ‰
  πŸ‰

Dictionaries, add items.

  🏁 πŸ‡
    🍦 dict πŸ”· πŸ―πŸšπŸ”‘ 🐸
    🐷 dict πŸ”€JamesπŸ”€ πŸ”€USAπŸ”€
    🐷 dict πŸ”€MinhongπŸ”€ πŸ”€δΈ­ε›½πŸ”€
    🐷 dict πŸ”€AnjaπŸ”€ πŸ”€DeutschlandπŸ”€
    πŸ˜€ πŸͺπŸ”‘ πŸ” dict 10 πŸ”€ items in the dictionaryπŸ”€πŸͺ
  πŸ‰

Initialize the dictionary when you make it, and look up a value.

  🏁 πŸ‡
    🍦 dict 🍯
      πŸ”€JamesπŸ”€ πŸ”€USAπŸ”€
      πŸ”€MinhongπŸ”€ πŸ”€δΈ­ε›½πŸ”€
      πŸ”€AnjaπŸ”€ πŸ”€DeutschlandπŸ”€
    πŸ†
    🍦 home 🍺 🐽 dict πŸ”€JamesπŸ”€
    πŸ˜€ πŸͺπŸ”€James is from πŸ”€ homeπŸͺ
  πŸ‰

Questionnaire Example

  🏁 πŸ‡
    🍦 list 🍨
         πŸ”€Ask question 1?πŸ”€
         πŸ”€Ask question 2?πŸ”€
         πŸ”€Ask question 3?πŸ”€
         πŸ”€Ask question 4?πŸ”€
         πŸ”€Ask question 5?πŸ”€
         πŸ”€Ask question 6?πŸ”€
         πŸ”€Ask question 7?πŸ”€
         πŸ”€Ask question 8?πŸ”€
         πŸ”€Ask question 9?πŸ”€
         πŸ”€Ask question 10?πŸ”€
    πŸ†
    πŸ”‚ str list πŸ‡
         🍦 input πŸ”·πŸ”‘πŸ˜― str
         πŸ˜€ πŸͺπŸ”€You said: πŸ”€ inputπŸͺ
    πŸ‰
  πŸ‰

Infinate File Read

  πŸ“¦ files πŸ”΄
  🏁 πŸ‡
    πŸ” πŸ‘ πŸ‡
      πŸ₯‘ fileData πŸ©πŸ“‡πŸ“„ πŸ”€earth.txtπŸ”€ πŸ‡
        πŸ‘΄πŸ˜€ πŸͺπŸ”€Read πŸ”€ πŸ”‘ πŸ” fileData 10 πŸ”€ bytesπŸ”€ πŸͺ
        🍦 lines πŸ”« 🍺 πŸ”‘ fileData πŸ”€βŒnπŸ”€ 
        πŸ”‚ line lines πŸ‡
          πŸ˜€ line
          πŸ©β²πŸ’ˆ 1000000
        πŸ‰
      πŸ‰
      πŸ“ error πŸ‡
        πŸ˜€ πŸ”€πŸ˜’ Could not read fileπŸ”€
      πŸ‰
    πŸ‰
  πŸ‰