Skip to main content
added 70 characters in body
Source Link
Fongoid
  • 1.1k
  • 6
  • 12

[><> (Fish)][1]><> (Fish), 68 34 Bytes

ri&:o&:&=\
l&io& /!?/
?!;20.\l!\

You can run it at http://fishlanguage.com/playgroundhttp://fishlanguage.com/playground inputting the string as the initial stack (with " marks, i.e. "chameleon") and the array of extra letters as the input stack (no " marks i.e. caln).

Don't forget to press the Give button to seed the input stack.

r       reverses the stack
i&      reads in the first input, and stores it in the register
:o      copies the top of the stack, and outputs the top of the stack
&:&     puts register value on stack, copies it, then puts top stack into register
=       checks if the top two values are equal, if yes push 1, else push 0
?       if top value is non-zero, execute next instruction
!       skips the following instruction (unless it was skipped by the previous ?)

If yes, then we proceed on the same line
&o      puts register value on stack, and outputs it
i&      reads in the first input, and stores it in the register
l       puts length of stack on stack, then proceed to lowest line

If no, we go directly to the last line
l       As above.
?!;     If zero value (from length), then end execution
20.     Push 2 and 0 onto stack, then pop top two values, and go to that position (2,0) (i.e. next instruction is at (3,0))

EDIT: Halved it! :) [1]: http://esolangs.org/wiki/Fish

[><> (Fish)][1], 68 34 Bytes

ri&:o&:&=\
l&io& /!?/
?!;20.\l!\

You can run it at http://fishlanguage.com/playground inputting the string as the initial stack (with " marks, i.e. "chameleon") and the array of extra letters as the input stack (no " marks i.e. caln).

Don't forget to press the Give button to seed the input stack.

r       reverses the stack
i&      reads in the first input, and stores it in the register
:o      copies the top of the stack, and outputs the top of the stack
&:&     puts register value on stack, copies it, then puts top stack into register
=       checks if the top two values are equal, if yes push 1, else push 0
?       if top value is non-zero, execute next instruction
!       skips the following instruction (unless it was skipped by the previous ?)

If yes, then we proceed on the same line
&o      puts register value on stack, and outputs it
i&      reads in the first input, and stores it in the register
l       puts length of stack on stack, then proceed to lowest line

If no, we go directly to the last line
l       As above.
?!;     If zero value (from length), then end execution
20.     Push 2 and 0 onto stack, then pop top two values, and go to that position (2,0) (i.e. next instruction is at (3,0))

EDIT: Halved it! :) [1]: http://esolangs.org/wiki/Fish

><> (Fish), 68 34 Bytes

ri&:o&:&=\
l&io& /!?/
?!;20.\l!\

You can run it at http://fishlanguage.com/playground inputting the string as the initial stack (with " marks, i.e. "chameleon") and the array of extra letters as the input stack (no " marks i.e. caln).

Don't forget to press the Give button to seed the input stack.

r       reverses the stack
i&      reads in the first input, and stores it in the register
:o      copies the top of the stack, and outputs the top of the stack
&:&     puts register value on stack, copies it, then puts top stack into register
=       checks if the top two values are equal, if yes push 1, else push 0
?       if top value is non-zero, execute next instruction
!       skips the following instruction (unless it was skipped by the previous ?)

If yes, then we proceed on the same line
&o      puts register value on stack, and outputs it
i&      reads in the first input, and stores it in the register
l       puts length of stack on stack, then proceed to lowest line

If no, we go directly to the last line
l       As above.
?!;     If zero value (from length), then end execution
20.     Push 2 and 0 onto stack, then pop top two values, and go to that position (2,0) (i.e. next instruction is at (3,0))

EDIT: Halved it! :)

Halved byte count
Source Link
Fongoid
  • 1.1k
  • 6
  • 12

><> (Fish)[><> (Fish)][1], 6868 34 Bytes

ri&!/:o&:&=\
/.  ;      ?
    !     l&io& /!?/
\04 ?! ;;20.\l!?l/
    \l&io& /\

You can run it at http://fishlanguage.com/playground inputting the string as the initial stack (with " marks, i.e. "chameleon") and the array of extra letters as the input stack (no " marks i.e. caln).

Don't forget to press the Give button to seed the input stack.

r       reverses the stack
i&      reads in the first input, and stores it in the register
!       skips the followig instruction
:o      copies the top of the stack, and outputs the top of the stack
&:&     puts register value on stack, copies it, then puts top stack into register
=       checks if the top two values are equal, if yes push 1, else push 0
?       if top value is non-zero, execute next instruction
!       skips the following instruction (unless it was skipped by the previous ?)

Now there are two paths, either the values were equal (value in register and top of stack) or not

If yes, then we proceed toon the lowestsame line
&o      puts register value on stack, and outputs it
i&      reads in the first input, and stores it in the register
l?!;       puts length of stack on stack, if non-0, skip the ; which is endthen statement,proceed elseto terminatelowest programline

If no, we go directly to the 2nd lowestlast line
l?!;       As above.
40?!;     If zero value (from length), then end execution
20.     Push 42 and 0 onto stack, then pop top two values, and go to that position (42,0) (i.e. next instruction is at (53,0))

EDIT: Halved it! :) [1]: http://esolangs.org/wiki/Fish

><> (Fish), 68 Bytes

ri&!/:o&:&=\
/.  ;      ?
    !      !
\04 ?! ;!?l/
    \l&io& /

You can run it at http://fishlanguage.com/playground inputting the string as the initial stack (with " marks, i.e. "chameleon") and the array of extra letters as the input stack (no " marks i.e. caln).

Don't forget to press the Give button to seed the input stack.

r       reverses the stack
i&      reads in the first input, and stores it in the register
!       skips the followig instruction
:o      copies the top of the stack, and outputs the top of the stack
&:&     puts register value on stack, copies it, then puts top stack into register
=       checks if the top two values are equal, if yes push 1, else push 0
?       if top value is non-zero, execute next instruction
!       skips the following instruction (unless it was skipped by the previous ?)

Now there are two paths, either the values were equal (value in register and top of stack) or not

If yes, then we proceed to the lowest line
&o      puts register value on stack, and outputs it
i&      reads in the first input, and stores it in the register
l?!;    puts length of stack on stack, if non-0, skip the ; which is end statement, else terminate program

If no, we go to the 2nd lowest line
l?!;    As above.
40.     Push 4 and 0 onto stack, then pop top two values, and go to that position (4,0) (i.e. next instruction is at (5,0))

[><> (Fish)][1], 68 34 Bytes

ri&:o&:&=\
l&io& /!?/
?!;20.\l!\

You can run it at http://fishlanguage.com/playground inputting the string as the initial stack (with " marks, i.e. "chameleon") and the array of extra letters as the input stack (no " marks i.e. caln).

Don't forget to press the Give button to seed the input stack.

r       reverses the stack
i&      reads in the first input, and stores it in the register
:o      copies the top of the stack, and outputs the top of the stack
&:&     puts register value on stack, copies it, then puts top stack into register
=       checks if the top two values are equal, if yes push 1, else push 0
?       if top value is non-zero, execute next instruction
!       skips the following instruction (unless it was skipped by the previous ?)

If yes, then we proceed on the same line
&o      puts register value on stack, and outputs it
i&      reads in the first input, and stores it in the register
l       puts length of stack on stack, then proceed to lowest line

If no, we go directly to the last line
l       As above.
?!;     If zero value (from length), then end execution
20.     Push 2 and 0 onto stack, then pop top two values, and go to that position (2,0) (i.e. next instruction is at (3,0))

EDIT: Halved it! :) [1]: http://esolangs.org/wiki/Fish

added 10 characters in body
Source Link
Fongoid
  • 1.1k
  • 6
  • 12

><> (Fish), 68 Bytes

ri&!/:o&:&=\
/.  ;      ?
    !      !
\04 ?! ;!?l/
    \l&io& /

You can run it at http://fishlanguage.com/playground inputting the string as the initial stack (with " marks, i.e. "chameleon") and the array of extra letters as the input stack (no " marks i.e. caln).

Don't forget to press the Give button to seed the input stack.

r       reverses the stack
i&      reads in the first input, and stores it in the register
!       skips the followig instruction
:o      copies the top of the stack, and outputs the top of the stack
&:&     puts register value on stack, copies it, then puts top stack into register
=       checks if the top two values are equal, if yes push 1, else push 0
?       if top value is non-zero, execute next instruction
!       skips the following instruction (unless it was skipped by the previous ?)

Now there are two paths, either the values were equal (value in register and top of stack) or not

If yes, then we proceed to the lowest line
&o      puts register value on stack, and outputs it
i&      reads in the first input, and stores it in the register
l?!;    puts length of stack on stack, if non-0, skip the ; which is end statement, else terminate program

If no, we go to the 2nd lowest line
l?!;    As above.
40.     Push 4 and 0 onto stack, then pop top two values, and go to that position (4,0) (i.e. next instruction is at (5,0))

><> (Fish)

ri&!/:o&:&=\
/.  ;      ?
    !      !
\04 ?! ;!?l/
    \l&io& /

You can run it at http://fishlanguage.com/playground inputting the string as the initial stack (with " marks, i.e. "chameleon") and the array of extra letters as the input stack (no " marks i.e. caln).

Don't forget to press the Give button to seed the input stack.

r       reverses the stack
i&      reads in the first input, and stores it in the register
!       skips the followig instruction
:o      copies the top of the stack, and outputs the top of the stack
&:&     puts register value on stack, copies it, then puts top stack into register
=       checks if the top two values are equal, if yes push 1, else push 0
?       if top value is non-zero, execute next instruction
!       skips the following instruction (unless it was skipped by the previous ?)

Now there are two paths, either the values were equal (value in register and top of stack) or not

If yes, then we proceed to the lowest line
&o      puts register value on stack, and outputs it
i&      reads in the first input, and stores it in the register
l?!;    puts length of stack on stack, if non-0, skip the ; which is end statement, else terminate program

If no, we go to the 2nd lowest line
l?!;    As above.
40.     Push 4 and 0 onto stack, then pop top two values, and go to that position (4,0) (i.e. next instruction is at (5,0))

><> (Fish), 68 Bytes

ri&!/:o&:&=\
/.  ;      ?
    !      !
\04 ?! ;!?l/
    \l&io& /

You can run it at http://fishlanguage.com/playground inputting the string as the initial stack (with " marks, i.e. "chameleon") and the array of extra letters as the input stack (no " marks i.e. caln).

Don't forget to press the Give button to seed the input stack.

r       reverses the stack
i&      reads in the first input, and stores it in the register
!       skips the followig instruction
:o      copies the top of the stack, and outputs the top of the stack
&:&     puts register value on stack, copies it, then puts top stack into register
=       checks if the top two values are equal, if yes push 1, else push 0
?       if top value is non-zero, execute next instruction
!       skips the following instruction (unless it was skipped by the previous ?)

Now there are two paths, either the values were equal (value in register and top of stack) or not

If yes, then we proceed to the lowest line
&o      puts register value on stack, and outputs it
i&      reads in the first input, and stores it in the register
l?!;    puts length of stack on stack, if non-0, skip the ; which is end statement, else terminate program

If no, we go to the 2nd lowest line
l?!;    As above.
40.     Push 4 and 0 onto stack, then pop top two values, and go to that position (4,0) (i.e. next instruction is at (5,0))
Source Link
Fongoid
  • 1.1k
  • 6
  • 12
Loading