https://github.com/danielaf07/hands-programming-challenge
https://github.com/danielaf07/hands-programming-challenge
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/danielaf07/hands-programming-challenge
- Owner: DanielAF07
- Created: 2022-04-29T01:49:07.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-04-29T01:49:47.000Z (about 4 years ago)
- Last Synced: 2025-02-10T04:31:47.475Z (over 1 year ago)
- Language: JavaScript
- Size: 86.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Introduction
You find a strange mirror that always shows a hand that is moving.
The hand appears to be alive, and after a lot of questions of "yes" and "no" answer, you know that the hand is trying to teach you a program that is written in HPL (Hand Programming Language).
This language works with a memory of an indefinite size of bytes, with all values initialized to 0.
This language haves 7 instructions:
👉 : moves the memory pointer to the next cell
👈 : moves the memory pointer to the previous cell
👆 : increment the memory cell at the current position
👇 : decreases the memory cell at the current position.
🤜 : if the memory cell at the current position is 0, jump just after the corresponding 🤛
🤛 : if the memory cell at the current position is not 0, jump just after the corresponding 🤜
👊 : Display the current character represented by the ASCII code defined by the current position.
## Notes:
- As memory cells are bytes, from 0 to 255 value, if you decrease 0 you'll get 255, if you increment 255 you'll get 0.
- Loops of 🤜 and 🤛 can be nested.
# Tests
The hand shows you two small programs and their outputs:
## This program display "Hello"
👇🤜👇👇👇👇👇👇👇👉👆👈🤛👉👇👊👇🤜👇👉👆👆👆👆👆👈🤛👉👆👆👊👆👆👆👆👆👆👆👊👊👆👆👆👊
## This program (with nested loops) display "Hello World!"
👉👆👆👆👆👆👆👆👆🤜👇👈👆👆👆👆👆👆👆👆👆👉🤛👈👊👉👉👆👉👇🤜👆🤛👆👆👉👆👆👉👆👆👆🤜👉🤜👇👉👆👆👆👈👈👆👆👆👉🤛👈👈🤛👉👇👇👇👇👇👊👉👇👉👆👆👆👊👊👆👆👆👊👉👇👊👈👈👆🤜👉🤜👆👉👆🤛👉👉🤛👈👇👇👇👇👇👇👇👇👇👇👇👇👇👇👊👉👉👊👆👆👆👊👇👇👇👇👇👇👊👇👇👇👇👇👇👇👇👊👉👆👊👉👆👊
# Challenge
The file "input.hand" is the code of the program
Good luck!