Giter Site home page Giter Site logo

emoji-karel's Introduction

Emoji-Karel

Using emojis instead of words to create a programming language that moves a robot in a 2D world. Based on the programming language called Karel, which is used to teach basic programming skills, like loops and conditions.

Use the following emojis:

  1. โžก Moves the robot (Karel) forward
  2. โ†บ Turns Karel left
  3. ๐Ÿค” Indicates 'if'
  4. ๐Ÿ™ Indicates 'else'
  5. ๐Ÿ”„ Indicates 'while' loops
  6. ๐Ÿšซ Indicates 'not'
  7. ๐Ÿงฑ Makes Karel check if the wall to its front is blocked

Sample if-else statement (Karel turns left if the front is blocked, otherwise, it moves forward):

๐Ÿค” (๐Ÿงฑ) {
    โ†บ
} ๐Ÿ™ {
    โžก
}

Sample while loops (Note that you can use while loops in two ways - either put a condition inside the parenthesis, in which case the loop will repeat until the condition becomes false; or put a number inside the parenthesis, which repeats the loop that many times similar to that of a for loop)

  1. Condition-based while loop (Karel moves forward until it hits a wall):
๐Ÿ”„ (๐Ÿšซ ๐Ÿงฑ) {
    โžก
}
  1. Counter-based while loop a.k.a for loops (Karel turns left 4 times):
๐Ÿ”„ (4) {
    โ†บ
}

Example code (Makes Karel move around the edge of the 2D world once)

๐Ÿ”„ (4) {
    ๐Ÿ”„ (๐Ÿšซ ๐Ÿงฑ) {
        โžก
    }
    โ†บ
}

For now, the program is only tested on linux

Requirements

SFML

Setup

The main file to be run is main.out. To generate this file, run the following command in the terminal

make main.out

How to use

Run the following command to start the program:

./main.out

Then type the code you want to run in the terminal and press EOF. A window should appear where you will see Karel in the bottom right of a 8x8 board. Press space to make Karel execute the next movement instruction (โžก or โ†บ). If the program successfully runs without Karel crashing towards any wall, the bottom region of the window shoud show Karel has executed successfully. But if Karel moves towards a wall, the bottom region will show Karel can't move in that direction. In either case, pressing space again will quit the window (and the program).

Alternatively, you can write your program in a text file and send it to main.out as standard input using <.

Karel also creates a temporary text file containing a custom assembly language for Karel. Whenever space is pressed, Karel executes instructions from this assembly file. By default, the file's name is temp.krl. However, you can specifiy a name for the temporary text file by passing the file name as an argument to the command (that is, as argv[1]).

emoji-karel's People

Contributors

ruko97 avatar

Stargazers

Jahir Sadik Monon avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.