Skip to main content
removed 3 bytes
Source Link
SevC_10
  • 469
  • 3
  • 8

Python 3, 138 bytes

Easy translation of the interpreter language instructions:

for i in[len(o)/11for o in input().split(' ')]:
 if i==1:a=0
 if i==2:a=a+1
 if i==3:a=a-1
 if i==4:a=a*2
 if i==5:a=a/2
 if i==6:print(a)

Try it online!

In the first line:

  1. takes the input
  2. split the instructions separated by a space
  3. divide by 11 (the lenght of the base word interpreter) to get the corresponding operation

The subsequent if execute the operations on the accumulator.

EDIT: theoretical improvements, code not modified (see version 2). Anyway, thanks for the suggestions!

-4 bytes thanks to @expressjs123

-3 bytes thanks to @ElPedro


VERSION 2

Python 3, 97 9696 93 bytes

Improved the selection of the instructions simply by using list slicing.

-41 bytes compared to original version.

-1 byte thanks to @ElPedro

-3 bytes thanks to @Zaelin Goodman

a=0
for i in[len(o)//11for o in input().split()]:
 a=[0,a+1,a-=[a,-1,a*21,-a,a/2,a][i0][i-1]
 if i>5:print(a)

Try it online!Try it online!

Python 3, 138 bytes

Easy translation of the interpreter language instructions:

for i in[len(o)/11for o in input().split(' ')]:
 if i==1:a=0
 if i==2:a=a+1
 if i==3:a=a-1
 if i==4:a=a*2
 if i==5:a=a/2
 if i==6:print(a)

Try it online!

In the first line:

  1. takes the input
  2. split the instructions separated by a space
  3. divide by 11 (the lenght of the base word interpreter) to get the corresponding operation

The subsequent if execute the operations on the accumulator.

EDIT: theoretical improvements, code not modified (see version 2). Anyway, thanks for the suggestions!

-4 bytes thanks to @expressjs123

-3 bytes thanks to @ElPedro


VERSION 2

Python 3, 97 96 bytes

Improved the selection of the instructions simply by using list slicing.

-41 bytes compared to original version.

-1 byte thanks to @ElPedro

a=0
for i in[len(o)//11for o in input().split()]:
 a=[0,a+1,a-1,a*2,a/2,a][i-1]
 if i>5:print(a)

Try it online!

Python 3, 138 bytes

Easy translation of the interpreter language instructions:

for i in[len(o)/11for o in input().split(' ')]:
 if i==1:a=0
 if i==2:a=a+1
 if i==3:a=a-1
 if i==4:a=a*2
 if i==5:a=a/2
 if i==6:print(a)

Try it online!

In the first line:

  1. takes the input
  2. split the instructions separated by a space
  3. divide by 11 (the lenght of the base word interpreter) to get the corresponding operation

The subsequent if execute the operations on the accumulator.

EDIT: theoretical improvements, code not modified (see version 2). Anyway, thanks for the suggestions!

-4 bytes thanks to @expressjs123

-3 bytes thanks to @ElPedro


VERSION 2

Python 3, 97 96 93 bytes

Improved the selection of the instructions simply by using list slicing.

-41 bytes compared to original version.

-1 byte thanks to @ElPedro

-3 bytes thanks to @Zaelin Goodman

a=0
for i in[len(o)//11for o in input().split()]:
 a-=[a,-1,1,-a,a/2,0][i-1]
 if i>5:print(a)

Try it online!

removed 1 byte
Source Link
SevC_10
  • 469
  • 3
  • 8

Python 3, 138 bytes

Easy translation of the interpreter language instructions:

for i in[len(o)/11for o in input().split(' ')]:
 if i==1:a=0
 if i==2:a=a+1
 if i==3:a=a-1
 if i==4:a=a*2
 if i==5:a=a/2
 if i==6:print(a)

Try it online!

In the first line:

  1. takes the input
  2. split the instructions separated by a space
  3. divide by 11 (the lenght of the base word interpreter) to get the corresponding operation

The subsequent if execute the operations on the accumulator.

EDIT: theoretical improvements, code not modified (see version 2). Anyway, thanks for the suggestions!

-4 bytes thanks to @expressjs123

-3 bytes thanks to @ElPedro


VERSION 2

Python 3, 9797 96 bytes

Improved the selection of the instructions simply by using list slicing.

-41 bytes compared to original version.

-1 byte thanks to @ElPedro

a=0
for i in[len(o)//11for o in input().split()]:
 a=[0,a+1,a-1,a*2,a/2,a][i-1]
 if i==6i>5:print(a)

Try it online!Try it online!

Python 3, 138 bytes

Easy translation of the interpreter language instructions:

for i in[len(o)/11for o in input().split(' ')]:
 if i==1:a=0
 if i==2:a=a+1
 if i==3:a=a-1
 if i==4:a=a*2
 if i==5:a=a/2
 if i==6:print(a)

Try it online!

In the first line:

  1. takes the input
  2. split the instructions separated by a space
  3. divide by 11 (the lenght of the base word interpreter) to get the corresponding operation

The subsequent if execute the operations on the accumulator.

EDIT: theoretical improvements, code not modified (see version 2). Anyway, thanks for the suggestions!

-4 bytes thanks to @expressjs123

-3 bytes thanks to @ElPedro


VERSION 2

Python 3, 97 bytes

Improved the selection of the instructions simply by using list slicing.

-41 bytes compared to original version.

a=0
for i in[len(o)//11for o in input().split()]:
 a=[0,a+1,a-1,a*2,a/2,a][i-1]
 if i==6:print(a)

Try it online!

Python 3, 138 bytes

Easy translation of the interpreter language instructions:

for i in[len(o)/11for o in input().split(' ')]:
 if i==1:a=0
 if i==2:a=a+1
 if i==3:a=a-1
 if i==4:a=a*2
 if i==5:a=a/2
 if i==6:print(a)

Try it online!

In the first line:

  1. takes the input
  2. split the instructions separated by a space
  3. divide by 11 (the lenght of the base word interpreter) to get the corresponding operation

The subsequent if execute the operations on the accumulator.

EDIT: theoretical improvements, code not modified (see version 2). Anyway, thanks for the suggestions!

-4 bytes thanks to @expressjs123

-3 bytes thanks to @ElPedro


VERSION 2

Python 3, 97 96 bytes

Improved the selection of the instructions simply by using list slicing.

-41 bytes compared to original version.

-1 byte thanks to @ElPedro

a=0
for i in[len(o)//11for o in input().split()]:
 a=[0,a+1,a-1,a*2,a/2,a][i-1]
 if i>5:print(a)

Try it online!

added second version
Source Link
SevC_10
  • 469
  • 3
  • 8

Python 3, 138138 bytes

Easy translation of the interpreter language instructions:

for i in[len(o)/11for o in input().split(' ')]:
 if i==1:a=0
 if i==2:a=a+1
 if i==3:a=a-1
 if i==4:a=a*2
 if i==5:a=a/2
 if i==6:print(a)

Try it online!

In the first line:

  1. takes the input
  2. split the instructions separated by a space
  3. divide by 11 (the lenght of the base word interpreter) to get the corresponding operation

The subsequent if execute the operations on the accumulator.

EDIT: theoretical improvements, code not modified (see version 2). Anyway, thanks for the suggestions!

-4 bytes thanks to @expressjs123

-3 bytes thanks to @ElPedro


VERSION 2

Python 3, 97 bytes

Improved the selection of the instructions simply by using list slicing.

-41 bytes compared to original version.

a=0
for i in[len(o)//11for o in input().split()]:
 a=[0,a+1,a-1,a*2,a/2,a][i-1]
 if i==6:print(a)

Try it online!

Python 3, 138 bytes

Easy translation of the interpreter language instructions:

for i in[len(o)/11for o in input().split(' ')]:
 if i==1:a=0
 if i==2:a=a+1
 if i==3:a=a-1
 if i==4:a=a*2
 if i==5:a=a/2
 if i==6:print(a)

Try it online!

In the first line:

  1. takes the input
  2. split the instructions separated by a space
  3. divide by 11 (the lenght of the base word interpreter) to get the corresponding operation

The subsequent if execute the operations on the accumulator.

Python 3, 138 bytes

Easy translation of the interpreter language instructions:

for i in[len(o)/11for o in input().split(' ')]:
 if i==1:a=0
 if i==2:a=a+1
 if i==3:a=a-1
 if i==4:a=a*2
 if i==5:a=a/2
 if i==6:print(a)

Try it online!

In the first line:

  1. takes the input
  2. split the instructions separated by a space
  3. divide by 11 (the lenght of the base word interpreter) to get the corresponding operation

The subsequent if execute the operations on the accumulator.

EDIT: theoretical improvements, code not modified (see version 2). Anyway, thanks for the suggestions!

-4 bytes thanks to @expressjs123

-3 bytes thanks to @ElPedro


VERSION 2

Python 3, 97 bytes

Improved the selection of the instructions simply by using list slicing.

-41 bytes compared to original version.

a=0
for i in[len(o)//11for o in input().split()]:
 a=[0,a+1,a-1,a*2,a/2,a][i-1]
 if i==6:print(a)

Try it online!

Source Link
SevC_10
  • 469
  • 3
  • 8
Loading