Pinyin

From Esolang
Jump to navigation Jump to search

Pinyin is a fungeoid invented by User:None1 that uses Chinese characters and Pinyin (a way of representing the pronounciation of Chinese characters using Latin letters).

To avoid ambiguity, "this esolang" instead of "Pinyin" is used when referring to the esolang.

Memory

This esolang has a stack with unbounded signed integers. Popping from it returns 0.

The upper edge and left edge of the grid is solid, like Nopfunge Solid.

Syntax

Parts of a Pinyin

To know the syntax of the esolang, you have to learn the three parts of a Pinyin: tone, consonant part and vowel part. It's hard to explain that to foreigners (non-Chinese people), so examples are used to help understanding.

Examples of 3 parts of a Pinyin
Character Tone C. Part V.Part
1 y i
4 / er
0 d e
3 w o
2 r en

Note: For simplicity, ü is the same as u in this esolang.

Commands

In this esolang, a command is a Chinese character.

Unlike most 2D esolangs, one command has multiple effects created by different parts of the character's Pinyin.

The tone decides what direction the IP is facing after the command is executed:

Caption text
Tone Direction change
0 Random
1 Clockwise 90°
2 180°
3 Counterclockwise 90°
4 Unchanged

The vowel part decides other effects except changing the IP's direction.

Vowel part effects
Vowel part Effect
a Pop stack and output as integer
o Pop stack and output as Unicode character
e Input an integer and pushes into stack
i Input a character and pushes it's Unicode value into stack
u Pop a,b, pushes a+b
ai Pop a,b, pushes b-a
an Pop a,b, pushes a*b
ang Pop a,b, pushes b%a
ao Pop a,b, pushes floor(b/a)
ei Pop a,b, pushes ceil(b/a)
en Pushes random integer from 0 to 1 into stack
ui Pop a,b, pushes b**a
un Pop a,pushes the number of decimal digits in a
in Duplicate top
eng Push the number of elements in the stack
ong Pop a,b, pushes a&b
ing b
ui Pop a,b, pushes a^b
ou Pop a, pushes ~a
er Pushes 1
i/u+any other vowel part Equivalent to that vowel part
Other NOP

The consonant part decides the condition for this command to be executed. If the condition isn't satisfied, the command is simply a NOP.

Consonant part conditions
Consonant part Condition
No consonant part Never satisfied
b If stack is empty
p If stack is nonempty
m If stack top is zero
f If stack top is nonzero
g Pop a,b, b<a
k Pop a,b, b>a
h Pop a,b, b<=a
j Pop a,b, b<=a
q Pop a,b, b==a
x Pop a,b, b!=a
Other Unconditional

Examples

Hello, world!

we assume that the vowel for eg. 丢(diu1) is iu, not u.

邓邓禄聘聘聘禄禄聘聘但聘邓邓道代但泼
扭二二二二二二二二二二二二二二二二丢
扭聘聘聘印聘聘禄兔聘蛋兔聘蛋兔聘泼
扭二二二二二二二二二二二二二二二丢
扭印印道聘禄印印印但但印印到带兔聘聘泼
扭二二二二二二二二二二二二二二二二二泼
扭路怒泼
扭二二丢
扭邓邓凳邓但但但待漏印禄泼
扭二二二二二二二二二二二丢
扭印聘兔聘聘兔兑印兔印印印泼
扭二二二二二二二二二二二二丢
扭禄禄邓邓凳禄禄戴印泼
扭二二二二二二二二二丢
扭聘禄邓邓凳邓淡淡蛋印印到印兔到戴印凳戴泼
扭二二二二二二二二二二二二二二二二二二二丢
扭印泼
扭二丢
扭邓邓凳邓禄兔禄带印邓邓印印到兔兔兔泼
扭二二二二二二二二二二二二二二二二二泼
扭印聘兔聘聘兔兑印兔兔泼

Cat program

砰踢
身泼

The proof that it works is left as an exercise to the reader.

Truth machine

这印妈钠钠盆凳印印印到大到印印印凳牛

The proof that it works is also left as an exercise to the reader.