( ͡° ͜ʖ ͡°)fuck

From Esolang
Jump to navigation Jump to search

( ͡° ͜ʖ ͡°)fuck is a derivate of Brainfuck+3 but with lenny faces.

Commands

Instruction Lenny-counterpart
+ ( ͡° ͜ʖ ͡°)
- (> ͜ʖ<)
. (♥ ͜ʖ♥)
, ᕙ( ͡° ͜ʖ ͡°)ᕗ
< (∩ ͡° ͜ʖ ͡°)⊃━☆゚.*
> ᕦ( ͡°ヮ ͡°)ᕥ
^ ᕦ( ͡° ͜ʖ ͡°)ᕥ
v ( ͡°╭͜ʖ╮ ͡°)
x ಠ_ಠ
[ ( ͡°(
] ) ͡°)

Examples

Hello, World!

The following program prints Hello World! (taken from Brainfuck).

( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡°(ᕦ( ͡°ヮ ͡°)ᕥ( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)
( ͡°(ᕦ( ͡°ヮ ͡°)ᕥ( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)ᕦ( ͡°ヮ ͡°)ᕥ( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)ᕦ( ͡°ヮ ͡°)ᕥ( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)ᕦ( ͡°ヮ ͡°)ᕥ
( ͡° ͜ʖ ͡°)(∩ ͡° ͜ʖ ͡°)⊃━☆゚.*(∩ ͡° ͜ʖ ͡°)⊃━☆゚.*(∩ ͡° ͜ʖ ͡°)⊃━☆゚.*(∩ ͡° ͜ʖ ͡°)⊃━☆゚.*(> ͜ʖ<)) ͡°)ᕦ( ͡°ヮ ͡°)ᕥ( ͡° ͜ʖ ͡°)ᕦ( ͡°ヮ ͡°)ᕥ( ͡° ͜ʖ ͡°)
ᕦ( ͡°ヮ ͡°)ᕥ(> ͜ʖ<)ᕦ( ͡°ヮ ͡°)ᕥᕦ( ͡°ヮ ͡°)ᕥ( ͡° ͜ʖ ͡°)( ͡°((∩ ͡° ͜ʖ ͡°)⊃━☆゚.*) ͡°)(∩ ͡° ͜ʖ ͡°)⊃━☆゚.*(> ͜ʖ<)) ͡°)ᕦ( ͡°ヮ ͡°)ᕥᕦ( ͡°ヮ ͡°)ᕥ(♥ ͜ʖ♥)
ᕦ( ͡°ヮ ͡°)ᕥ(> ͜ʖ<)(> ͜ʖ<)(> ͜ʖ<)(♥ ͜ʖ♥)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)(♥ ͜ʖ♥)(♥ ͜ʖ♥)( ͡° ͜ʖ ͡°)
( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)(♥ ͜ʖ♥)ᕦ( ͡°ヮ ͡°)ᕥᕦ( ͡°ヮ ͡°)ᕥ(♥ ͜ʖ♥)(∩ ͡° ͜ʖ ͡°)⊃━☆゚.*(> ͜ʖ<)(♥ ͜ʖ♥)(∩ ͡° ͜ʖ ͡°)⊃━☆゚.*(♥ ͜ʖ♥)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)
(♥ ͜ʖ♥)(> ͜ʖ<)(> ͜ʖ<)(> ͜ʖ<)(> ͜ʖ<)(> ͜ʖ<)(> ͜ʖ<)(♥ ͜ʖ♥)(> ͜ʖ<)(> ͜ʖ<)(> ͜ʖ<)(> ͜ʖ<)(> ͜ʖ<)(> ͜ʖ<)(> ͜ʖ<)(> ͜ʖ<)(♥ ͜ʖ♥)ᕦ( ͡°ヮ ͡°)ᕥᕦ( ͡°ヮ ͡°)ᕥ
( ͡° ͜ʖ ͡°)(♥ ͜ʖ♥)ᕦ( ͡°ヮ ͡°)ᕥ( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)(♥ ͜ʖ♥)ಠ_ಠ

This is code so that instead of going left and right, it goes up and down.

( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡°(
ᕦ( ͡° ͜ʖ ͡°)ᕥ( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡°(ᕦ( ͡° ͜ʖ ͡°)ᕥ( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)ᕦ( ͡° ͜ʖ ͡°)ᕥ
( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)ᕦ( ͡° ͜ʖ ͡°)ᕥ( ͡° ͜ʖ ͡°)
( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)ᕦ( ͡° ͜ʖ ͡°)ᕥ( ͡° ͜ʖ ͡°)( ͡°╭͜ʖ╮ ͡°)( ͡°╭͜ʖ╮ ͡°)( ͡°╭͜ʖ╮ ͡°)( ͡°╭͜ʖ╮ ͡°)(> ͜ʖ<)) ͡°)
ᕦ( ͡° ͜ʖ ͡°)ᕥ( ͡° ͜ʖ ͡°)ᕦ( ͡° ͜ʖ ͡°)ᕥ( ͡° ͜ʖ ͡°)ᕦ( ͡° ͜ʖ ͡°)ᕥ(> ͜ʖ<)ᕦ( ͡° ͜ʖ ͡°)ᕥᕦ( ͡° ͜ʖ ͡°)ᕥ( ͡° ͜ʖ ͡°)
( ͡°(( ͡°╭͜ʖ╮ ͡°)) ͡°)( ͡°╭͜ʖ╮ ͡°)(> ͜ʖ<)) ͡°)ᕦ( ͡° ͜ʖ ͡°)ᕥᕦ( ͡° ͜ʖ ͡°)ᕥ(♥ ͜ʖ♥)ᕦ( ͡° ͜ʖ ͡°)ᕥ(> ͜ʖ<)(> ͜ʖ<)
(> ͜ʖ<)(♥ ͜ʖ♥)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)(♥ ͜ʖ♥)(♥ ͜ʖ♥)
( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)(♥ ͜ʖ♥)ᕦ( ͡° ͜ʖ ͡°)ᕥᕦ( ͡° ͜ʖ ͡°)ᕥ(♥ ͜ʖ♥)( ͡°╭͜ʖ╮ ͡°)
(> ͜ʖ<)(♥ ͜ʖ♥)( ͡°╭͜ʖ╮ ͡°)(♥ ͜ʖ♥)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)(♥ ͜ʖ♥)(> ͜ʖ<)
(> ͜ʖ<)(> ͜ʖ<)(> ͜ʖ<)(> ͜ʖ<)(> ͜ʖ<)(♥ ͜ʖ♥)(> ͜ʖ<)(> ͜ʖ<)(> ͜ʖ<)(> ͜ʖ<)
(> ͜ʖ<)(> ͜ʖ<)(> ͜ʖ<)(> ͜ʖ<)(♥ ͜ʖ♥)ᕦ( ͡° ͜ʖ ͡°)ᕥᕦ( ͡° ͜ʖ ͡°)ᕥ( ͡° ͜ʖ ͡°)(♥ ͜ʖ♥)
ᕦ( ͡° ͜ʖ ͡°)ᕥ( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)(♥ ͜ʖ♥)ಠ_ಠ

Implementations

This is one implementation written in Python.

def run_lenny(code: str, actually_run = False) -> None:
    pointer = 0  # for instructions
    row = 0     # for up and down tape
    column = 0  # for left and right tape
    tape = [[0]]
    input_string = chr(10)  # allows multiple inputs easily

    corresponding_bracket = {}       # dictionary where the values are the corresponding bracket positions of the keys
    bracket_stack = []     # acts as a stack for the last bracket
    for num in range(len(code)):
        if code[num:num+5] == '( ͡°(':
            bracket_stack.append(num)
        elif code[num:num+5] == ') ͡°)':
            assert len(bracket_stack) > 0, 'unmatched ) ͡°)'
            corresponding_bracket[num] = bracket_stack[-1]
            corresponding_bracket[bracket_stack[-1]] = num
            bracket_stack.pop()
    assert balance == 0, 'unmatched ( ͡°('

    while pointer < len(code):
        skip = 1
        if code[pointer:pointer+11] == 'ᕦ( ͡°ヮ ͡°)ᕥ':
            column += 1
            if column == len(tape[row]):
                for row_number in range(len(tape)):
                    tape[row_number].append(0)
            skip = 11
        elif code[pointer:pointer+18] == '(∩ ͡° ͜ʖ ͡°)⊃━☆゚.*':
            column -= 1
            if column < 0:
                for row_number in range(len(tape)):
                    tape[row_number] = [0] + tape[row_number]
                column += 1
            skip = 18
        elif code[pointer:pointer+12] == '( ͡°╭͜ʖ╮ ͡°)':
            row += 1
            if row == len(tape):
                tape.append([0]*(column+1))
            skip = 12
        elif code[pointer:pointer+13] == 'ᕦ( ͡° ͜ʖ ͡°)ᕥ':
            row -= 1
            if row < 0:
                tape = [[0]*(column+1)] + tape
                row += 1
            skip = 13
        elif code[pointer:pointer+11] == '( ͡° ͜ʖ ͡°)':
            tape[row][column] = (tape[row][column] + 1) % 256
            skip = 11
        elif code[pointer:pointer+7] == '(> ͜ʖ<)':
            tape[row][column] = (tape[row][column] - 1) % 256
            skip = 7
        elif code[pointer:pointer+7] == '(♥ ͜ʖ♥)':
            print(chr(tape[row][column]),end='')
            skip = 7
        elif code[pointer:pointer+13] == 'ᕙ( ͡° ͜ʖ ͡°)ᕗ':
            if input_string == chr(10):
                input_string = input(">>") + chr(10)
            if len(input_string) > 0 and ord(input_string[0]) != chr(10):
                tape[row][column] = ord(input_string[0])
            input_string = input_string[1:]
            skip = 13
        elif code[pointer:pointer+5] == '( ͡°(':
            if tape[location] == 0:
                pointer = corresponding_bracket[pointer]
            skip = 5
        elif code[pointer:pointer+5] == ') ͡°)':
            if tape[location] == 0:
                pointer = corresponding_bracket[pointer]
        elif code[pointer:pointer+3] == 'ಠ_ಠ':
            break
        pointer += skip