https://github.com/0b01/portal
portal and portal 2
https://github.com/0b01/portal
Last synced: 2 months ago
JSON representation
portal and portal 2
- Host: GitHub
- URL: https://github.com/0b01/portal
- Owner: 0b01
- License: gpl-3.0
- Created: 2014-07-16T08:03:45.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2014-12-24T00:50:29.000Z (over 11 years ago)
- Last Synced: 2025-03-02T08:28:46.024Z (over 1 year ago)
- Language: Python
- Homepage: http://esolangs.org/wiki/Portal
- Size: 173 KB
- Stars: 5
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#Portal
Portal is an esoteric language that loosely implements the [Wang B-Machine](http://en.wikipedia.org/wiki/Wang_B-machine).
## What is this Portal language?
| Portal | Description |
|:---------: | :-----------------------------------------------------------------------|
| **o** | **Move the pointer to the other o portal** |
| > | Move the pointer to the right |
| < | Move the pointer to the left |
| + | Increment the memory cell under the pointer |
| - | Decrement the memory cell under the pointer |
| . | Output the character signified by the cell at the pointer |
| , | Input a character and store it in the cell at the pointer |
| **]** | **Move the first o portal to the right** |
| **[** | **Move the last o portal to the left** |
| Portal 2 | Description |
|:---------: | :-----------------------------------------------------------------------|
| **o** | **Move the pointer to the other o portal** |
| **O** | **Move the pointer to the other O portal** |
| > | Move the pointer to the right |
| < | Move the pointer to the left |
| + | Increment the memory cell under the pointer |
| - | Decrement the memory cell under the pointer |
| . | Output the character signified by the cell at the pointer |
| , | Input a character and store it in the cell at the pointer |
| **]** | **Move the first o portal to the right** |
| **[** | **Move the last o portal to the left** |
| **}** | **Move the first O portal to the right** |
| **{** | **Move the last O portal to the left** |
Important note: A pointer does not go in the a portal on the first pass. Check the examples.
## Example
###**Portal**: Prints an ampersand(&):
```
+++++++++++++o+++++]]]]]o++++++++++++++++++++.
```
Code trace:
```
+++++++++++++o+++++]]]]]o++++++++++++++++++++.
# omitted
+++++++++++++o+++++]]]]]o++++++++++++++++++++.
++++++++++++++o++++]]]]]o++++++++++++++++++++.
+++++++++++++++o+++]]]]]o++++++++++++++++++++.
++++++++++++++++o++]]]]]o++++++++++++++++++++.
+++++++++++++++++o+]]]]]o++++++++++++++++++++.
++++++++++++++++++o]]]]]o++++++++++++++++++++.
++++++++++++++++++o]]]]]o++++++++++++++++++++.
++++++++++++++++++]o]]]]o++++++++++++++++++++.
++++++++++++++++++]]o]]]o++++++++++++++++++++.
++++++++++++++++++]]]o]]o++++++++++++++++++++.
++++++++++++++++++]]]]o]o++++++++++++++++++++.
++++++++++++++++++]]]]]o++++++++++++++++++++.
++++++++++++++++++]]]]]o++++++++++++++++++++.
++++++++++++++++++]]]]]o++++++++++++++++++++.
# omitted
++++++++++++++++++]]]]]o++++++++++++++++++++.
```
###**Portal 2**
The following code prints an **Ö** [O with diaeresis](http://en.wikipedia.org/wiki/%C3%96)
```
O++++++o----}}o]]O.
```
Code trace:
```
O++++++o----}}o]]O.
O++++++o----}}o]]O.
O++++++o----}}o]]O.
O++++++o----}}o]]O.
O++++++o----}}o]]O.
O++++++o----}}o]]O.
O++++++o----}}o]]O.
O++++++o----}}o]]O.
O++++++o----}}o]]O.
O++++++o----}}o]]O.
O++++++o----}}o]]O.
O++++++o----}}o]]O.
+O+++++o----}}o]]O.
++O++++o----}}o]]O.
++O++++o----}}o]]O.
++O++++o----}}o]]O.
++O++++o----}}o]]O.
++O++++o----}}o]]O.
++O++++o----}}o]]O.
+++O+++o----}}o]]O.
++++O++o----}}o]]O.
++++O++o----}}o]]O.
++++O++o----}}o]]O.
++++O++o----}}o]]O.
++++O++o----}}o]]O.
++++O++o----}}o]]O.
+++++O+o----}}o]]O.
++++++Oo----}}o]]O.
++++++Oo----}}o]]O.
++++++Oo----}}o]]O.
++++++Oo----}}o]]O.
++++++Oo----}}o]]O.
++++++Oo----}}o]]O.
++++++oO----}}o]]O.
++++++o-O---}}o]]O.
++++++o-O---}}o]]O.
++++++o-O---}}o]]O.
++++++o-O---}}o]]O.
```
## Run
```
$ ./portal.py [filename]
$ ./portal2.py [filename]
```
# Help wanted
How do I print Hello World?
# Acknowledgement
The python interpreter is a fork of [pocmo/Python-Brainfuck](https://github.com/pocmo/Python-Brainfuck).