Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- EXPLANATION (or something like it)
- ____________________________________________________________________________________________________________________________
- idea: You have a stack of things that you can manipulate. When the program reaches the end the stack's last item gets printed but or doesn't if the push command is used anywhere in the code.
- explatation:
- When referenced to the stack I mean the dataStack. LINESTACK is the stack with line numbers.
- S-1 means the last thing in the stack, S-2 - the previous thing in the stack, ect.
- S0 means the first in the stack, S1 means second, ect.
- S means new thing in stack
- S-(1-x) means from S-1 to S-x inclusive
- A quick reference table of the functions:
- add input ask pop popRule copy order push MS1 MS2 stack exit repeat var jump jumpIf
- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
- 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
- so, the functions:
- 0000/1. add (adds last 2 things or if 1 is a string then joins).
- If there is only 1 thing then it acts like there would be 2 of them.
- If there is nothing it acts like an ask number and then cloned.
- 0001/2. start a string/number input for stack. 3 bytes for the length of the text/int and following x bytes will be added to stack as what they were asked as. Length table:
- bin 000 001 010 011 100 101 110 111
- equals 0bitStr 2bit NUMV 8bit num 16bit num 16bit num-+ 7bit str 14bit Str next 8 bytes say how many bit string
- 16bit num-+ is basically that 0000000000000000 = -65537 and 1111111111111111 = -2.
- 8-bit num starts from 2 and skips 10.
- 16-bit num starts with 258.
- 2bit NUMV:
- 00 -> -1
- 01 -> 0
- 10 -> 1
- 11 -> 10
- 0010/3. ask the runner for input. A single byte toggles wether to get a string(1) or number(0). Pushes to the stack.
- 0011/4. pop 3bytes:
- 000 001 010 011 100 101 110 111
- S-1 S-2 S-3 S-4 S-5 S-(1-2) S1 S2
- 0100/5. Switches wether to pop values when they are used. 4 bytes say to what to apply and 3 next bytes are what to pop. Example: to not pop letterXofY's inputs, do 0100 1001 000
- Mathstuff1 = math 1byters
- Mathstuff2 = math 2byters
- 0101/6. duplicates something in stack. Takes 2 bytes:
- 00 01 10 11
- copy S-1 copy S-2 copy S-3 copy S-4
- if the value is out of bounds, it'll add num 0 to stack
- 0110/7. Reorders the stack. Takes 5 bytes:
- the 1234 -> xxxx means that the last 4 things in the stack (example: 1, 2, 3, 4) to the x, x1, x2, x3.
- 00000 - move S0 to S (123456789 -> 234567891)
- 00001 - move S1 to S (123456789 -> 134567892)
- 00010 - 1234 -> 1243
- 00011 - 1234 -> 1342
- 00100 - 1234 -> 1324
- 00101 - 1234 -> 1432
- 00110 - 1234 -> 1423
- 00111 - 1234 -> 2431
- 01000 - 1234 -> 3421
- 01001 - 1234 -> 3241
- 01010 - 1234 -> 4321
- 01011 - 1234 -> 4231
- 01100 - 1234 -> 2341
- 01101 - 1234 -> 2413
- 01110 - 1234 -> 3412
- 01111 - 1234 -> 3214
- 10000 - 1234 -> 4312
- 10001 - 1234 -> 4213
- 10010 - 1234 -> 2314
- 10011 - 1234 -> 2143
- 10100 - 1234 -> 3142
- 10101 - 1234 -> 3124
- 10110 - 1234 -> 4132
- 10111 - 1234 -> 4123
- 11000 - 1234 -> 2134
- 11001 - 1234 -> S-5 to front
- 11010 - 1234 -> S-6 to front
- 11011 - 1234 -> S-7 to front
- 11100 - 1234 -> S-8 to front
- 11101 - 1234 -> S-9 to front
- 11110 - 1234 -> S-10 to front
- 11111 - 1234 -> S-11 to front
- 0111/8. pushes S-1 things from the stack to CONSOLE joined with " ". If S-1 is a string then use that as the joiner and push S-2 things.
- MATH STUFF: the number after the bytes is the POP rule it uses (only for ones with single input)
- 1000/9. math stuff 1: takes the last 0, 1 or 2 things in the stack and does the appropriate thing (default: 1-0, 2-1, 3-1)
- 3 bytes:
- 000 2 - round (or if S-1 is str then swapcase)
- 001 - multiply (or if one is string, != )
- 010 - letter S-1 of S-2
- 011 2 - abs (or if S-1 is str, reverse)
- 100 1 - sqrt (or if string, sqrt rounded up of lenght)
- 101 1 - sin (or if S-1 is string, takes last byte off of string & pushes the last char)
- 110 1 - length of S-1 string/num
- 111 3 - convert S-1 string to num/vice versa
- 1001/10. math stuff 2:
- 4 bytes:
- 0000 1 - cos (or if S-1 is string, takes 1st byte off of string & pushes the 1st char)
- 0001 - random from S-1 to S-2 (or if any is string, pick random either S-1 or S-2)
- 0010 - replace S-2 of S-3 with S-1
- 0011 2 - << (bitshiftleft) / divide by 2 and floor
- 0100 2 - >> (bitshiftright) / multiply by 2
- 0101 1 - asin
- 0110 - PI (adds value of PI to the stack (800 decimal places so math won't be able to utilize the full potentional of it but if converted to string you could do stuff with it))
- 0111 1 - convert string to num or back (may have problems with space as the 1st char)
- 1000 1 - sign (-1 if <0, 0 if =0, 1 if >0)
- 1001 - < (0 or 1 out) num
- 1010 - = (0 or 1 out) num
- 1011 - > (0 or 1 out) num
- 1100 - divide
- 1101 2 - floor (or if S-1 is str then lowercase)
- 1110 2 - ceiling (or if S-1 is str then capitalize)
- 1111 - sub (if one is string then replaces in S-3 S-1th thing with S-2)
- 1010/11. stack:
- if S-2 isn't NUM 0 or STR " " or STR "" then LINESTACK codeline S-1. Note that it goes to line not byte.
- 1011/12. exit:
- removes last thing from LINESTACK.
- 1100/13. repeat:
- write once before & after the loop. The before needs a following 1 and the ending - 0.
- Takes the S-1 before the 1st written thing as repeat times.
- If there is only one thing in linestack and there is a repeat in progress and the last line has just been executed, the repeat will loop back.
- 1101/14. variable:
- 1 byte determines either to set(0) or get(1) a variable. set pops the value and get adds the var value to stack.
- 3 bytes determine which variable to get/set.
- Useful if long values have to get repeated.
- Contains 8 predetermined values in them. Find those in sprites parser parseInit custom block.
- 1110/15: jump:
- jump to line S-1.
- 1111/16: jump if:
- if S-2 isn't NUM 0 or STR " " or STR "" then jump to codeline S-1. Note that it goes to line not byte.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement