Advertisement
dzaima

BYTT examples

Jul 25th, 2016
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.38 KB | None | 0 0
  1. EXAMPLES:
  2.  
  3.  
  4.  
  5. 'easy' example:
  6. 00101 ask for a string
  7. 1000110 get length of last thing in stack
  8. BINARY: 001011000110
  9. COMPILED: RX
  10.  
  11. ____________________________________
  12. 'intermediate' example: (the things after the explatation are the contents of the data stack for the 1st repeat)
  13. 0001 000 make an empty string ""
  14. 0010 1 ask for str "", "asked"
  15. 1001 1110 capitalize asked "", "ASKED"
  16. 0100 1001 000 change popping rule "", "ASKED"
  17. 1000 110 get the length "", "ASKED", 5
  18. 0101 00 copy length "", "ASKED", 5, 5
  19. 1100 1 start repeat "", "ASKED", 5
  20.  
  21. 1000 010 takes letter from asked "", "ASKED", 5, "D"
  22. 0110 10010 reorder to 1234 -> 2314 "ASKED", 5, "", "D"
  23. 0000 joins the last 2 "ASKED", 5, "D"
  24. 0110 00110 reorder to 1234 -> 1423 "D", "ASKED", 5
  25. 0001 001 00 adds a -1 to stack "D", "ASKED", 5, -1
  26. 0000 adds -1 to the count "D", "ASKED", 4
  27. 1100 0 end repeat
  28. 0110 00011 1234 -> 1342
  29. in one line:
  30. 0001000 00101 10011110 01001001000 1000110 010100 11001 1000 010 0110 10010 0000 0110 00110 0001 001 00 0000 11000 0110 00011
  31. BYTES: 000100000101100111100100100100010001100101001100110000100110100100000011000110000100100000011000011000011
  32. COMPILED: }.;>Jpvu3n!'7sw$
  33. V2 code: d%GDD1j9b:0,82!Ac
  34. ____________________________________
  35. HARD CHALLENGE: (currently in making)
  36. LINE CODE EXPLATATION 1st ITIRATION DATASTACK
  37. 1 0001 011 0000001000000000 adds 512 to stack 512
  38. 2 0101 00 clones the 512 512, 512
  39. 3 0001 001 11 adds 10 to stack 512, 512, 10
  40. 4 0100 0000 101 changes the pop rule to pop the S-2 512, 512, 10
  41. 5 1100 1 start a repeat 512, 512
  42. 6 1001 0011 bitshiftleft the last thing in stack 512, 256
  43. 7 0010 1 asks for a string 512, 256, "lower" (or whatever you inputted)
  44. 8 0001 001 01 adds 1 to stack 512, 256, "lower", 1
  45. 9 1000 010 gets the 1st letter from your input 512, 256, "l"
  46. 10 0001 101 1001100 add "l" to stack 512, 256, "l", "l"
  47. 11 1001 1010 compares the 2. 512, 256, 1 (if what you wrote in starts with "l")
  48. 12 0001 010 00010001 adds the line to jump to (line 17) 512, 256, 1, 00010001
  49. 13 1111 jump if what you wrote starts with "l" 512, 256
  50. 14 0000 adds the last 2 leaving the S-1 256, 768 (if what you wrote was "higher")
  51. 15 0001 010 11111111 adds the line to jump to (line xx) 256, 768, 11111111
  52. 16 1110 jumps to line xx
  53. 17
  54. 18
  55. 19
  56. 20
  57. idk 1100 0 end the repeat
  58.  
  59. ____________________________________
  60. prints out a=258, inputs being a=, 255, 3
  61. 0001110 01100000111100 input 14byte string in stack it being base95 for "a="
  62. 0001010 11111111 add to stack 255
  63. 0001010 00000011 add to stack 3
  64. 0000 add last 2, them being 3 and 255. Results in 258
  65. 0000 add last 2 them being "a=" and 258 resulting in "a=258"
  66.  
  67. BYTES: 00011100110000011110000010101111111100010100000001100000000
  68. COMPILED: !!^$BWB`D+
  69.  
  70.  
  71.  
  72. ____________________________________
  73. takes 2 inputs and adds them & adds a "a=" at the start
  74. 0001110 01100000111100 input 14byte string in stack it being base95 for "a="
  75. 00100 input 1
  76. 00100 input 2
  77. 0000 adds what you wrote in
  78. 0000 adds "a=" with the sum
  79. BYTES: 000111001100000111100001000010000000000
  80. COMPILED: o"h1SW
  81. _________________
  82. to take 2 inputs and add them:
  83. 0000 ADD; if add doesn't have any inputs, it asks for an input and puts 2 of them in the datastack. We'll ignore the 1st one.
  84. 0010 0 asks for a number
  85. 0000 adds them
  86. BYTES: 0000001000000
  87. COMPILED: "vv"
  88.  
  89. _________________
  90.  
  91. ____________________________________
  92. multiply by using only +1 and repeat in repeat:
  93. 0010 0
  94. 0101 11
  95. 0010 0
  96. 1100 1
  97. 0101 01
  98. 1100 1
  99. 0001 001 01
  100. 0000
  101. 1100 0
  102. 1100 0
  103. BYTES: 0010 0 0101 11 0010 0 1100 1 0101 01 1100 1 0001 001 01 0000 1100 0 1100 0
  104. 0010001011100100110010101011100100010010100001100011000
  105. COMPILED: 8`||@@iVM
  106.  
  107.  
  108. ____________________________________
  109. an old challenge to get the number 2007 without literals (for bytt - not using the function 0001 in the binary code)
  110. CODE DATASTACK EXPLANATION
  111. 1001 0000 1 gets COS(nothing) which equals 1
  112. 0000 2 adds the last 2 but as there aren't 2, adds to self
  113. 0000 4 adds the last 2 but as there aren't 2, adds to self
  114. 1000 001 16 multiplies last 2 but as there aren't 2, multiples to self (aka ^2)
  115. 0000 32 adds the last 2 but as there aren't 2, adds to self
  116. 1000 001 1024 multiplies last 2 but as there aren't 2, multiples to self (aka ^2)
  117. 0000 2048 adds the last 2 but as there aren't 2, adds to self
  118. 1000 100 2048, 45.25... takes the sqrt of 2048
  119. 1001 1000 2048, 45.25, 1 gets the sign of 45.25...
  120. 0101 00 2048, 45.25, 1, 1 duplicates the 1
  121. 0000 2048, 45.25, 2 adds the last 2
  122. 0101 00 2048, 45.25, 2, 2 duplicates the 2
  123. 0000 2048, 45.25, 4 adds the last 2
  124. 0110 00010 2048, 4, 45.25 swaps the last 2 places
  125. 1001 1111 2048, -41.25 substracts last 2
  126. 0000 2006.74.... adds last 2
  127. 1000 000 2007 rounds last
  128. ONE LINE: 1001 0000 0000 0000 1000 001 0000 1000 001 0000 1000 100 1001 1000 0101 00 0000 0101 00 0000 0110 00010 1001 1111 0000 1000 000
  129. BYTES: 10010000000000001000001000010000010000100010010011000010100000001010000000110000101001111100001000000
  130. COMPILED: (T=Aju1hkGQV<)r2
  131. V2 code: !D ""$$(ib`4!bGP`
  132. UPDATE: it now asks to input a number, input 0. This is because i'm implementing implicit input more and more.
  133.  
  134. ____________________________________
  135. counts to 20
  136. 0101 00 normally clones last but as last is nothing, adds num 0 to stack.
  137. 0001 010 00010100 adds 20 to stack
  138. 1100 1 starts a repeat
  139. 0001 001 10 adds a 1 to stack
  140. 0000 adds the last 2
  141. 0101 00 clones last
  142. 0001 001 10 adds a 1 to stack
  143. 0111 pushes S-1 things to console
  144. 1100 0 ends repeat
  145. BYTES: 010111000101000010100110010001001100000010100000100110011111000
  146. COMPILED: 3vZWp~Y>_D
  147.  
  148.  
  149.  
  150. ____________________________________
  151. write inputted string x times
  152. 0010 0 stacks a number input
  153. 0001 001 10 stacks the number 1
  154. 0000 add S-1 and S-2
  155. 0010 1 stacks a string input
  156. 0111 pushes S-2 things from the stack to CONSOLE joined with S-1
  157.  
  158.  
  159. ____________________________________
  160. some other examples (mainly from other language examples) (if you want an explanation, use the F menu to decompile the code and prettify it)
  161. the |s show below from where to where to copy code
  162.  
  163. | |
  164. |"dTS| prints "hi"
  165.  
  166. | |
  167. |}z%'qFy]P| prints "hi" 100 times
  168.  
  169. | |
  170. |>S{%M| is a legitly done forever CAT program, " is the shortProg of it
  171.  
  172. | |
  173. |JB+^*Wg}| counts forever. Fills up stack with all the numbers in order to save 6 bytes :p
  174.  
  175. | |
  176. |!#a| negates a number
  177.  
  178. |
  179. |
  180.  
  181. ____________________________________
  182. new challenges:
  183. the |s show below from where to where to copy code
  184. SIMPLE:
  185. | |
  186. |<S)FK&|1\| counts from 1 to 10
  187.  
  188. _______________
  189. 0001 011 0000000100000000 stacks a 16-bit number 256
  190. 0010 0 stacks a number input
  191. 1000 001 multiply 256*input
  192. 0010 0 stacks a number input
  193. 0000 add the multiplication and input
  194. 0001 011 0000000100000000 stacks a 16-bit number 256
  195. 1000 001 multiply 256*last thing
  196. 0010 0 stacks a number input
  197. 0000 add last thing & input
  198. BYTES: 00010110000000100000000001001000001001000000000101100000001000000001000001001000000
  199. COMPILED: 3INVbS>X 4}<\
  200.  
  201. ____________________________________
  202. INTERMEDIATE:
  203. 000111100010010101001000111111111110001000111000
  204. 1101 0 000 "chuck"
  205. 000111100001100100011111010010110000101101
  206. 1101 0 001 "wood"
  207. 000111100010010110101010011101000011101101110101
  208. 1101 0 011 "would"
  209. 1101 1 001 "wood"
  210. 1101 1 000 "chuck"
  211. 0000 "woodchuck"
  212. 1101 0 100 "woodchuck"
  213. 0001111001001011010001000011111011100001011011101001010111000111101 "How much"
  214. 1101 1 001 "wood"
  215. 1101 1 011 "would"
  216. 00011011000001 "a"
  217. 1101 1 100 "woodchuck"
  218. 1101 1 000 "chuck"
  219. 00011110000101111110001001010100111011110 "if a"
  220. 1101 1 100 "woodchuck"
  221. 000111100010010101001001010110110111100101100001 "could"
  222. 1101 1 000 "chuck"
  223. 1101 1 001 "wood"
  224. 00011010011111 "?"
  225. 0000
  226. 0001 010 00001011 push last 11 things
  227. 0111 push
  228. 00011010100001 "A"
  229. 1101 1 100 "woodchuck"
  230. 1101 1 011 "would"
  231. 1101 1 000 "chuck"
  232. 00101 ASK
  233. 0001 010 00000101 push last 6 things
  234. 0111 push
  235. BYTES: 00011110001001010100100011111111111000100011100011010000000111100001100100011111010010110000101101110100010001111000100101101010100111010000111011011101011101001111011001110110000000110101000001111001001011010001000011111011100001011011101001010111000111101110110011101101100011011000001110111001101100000011110000101111110001001010100111011110110111000001111000100101010010010101101101111001011000011101100011011001000110100111110000000101000001011011100011010100001110111001101101111011000001010001010000001010111
  236. COMPILED: &TG%8/14#GYomP+{/'entZzMgLC6,I/Hb`J'XC;XBU2@d-K25u m.z\sF]t<J#d2X?3+Gi_ssLa|T0a
  237. V2 CODE: gdJ1_\1QH#PR/rPMT1XEJnc{KsV=`:@\EHA]PMTKg}nV-@[m`\+\2IW{aXjDvWEcxV1sX"@MQt.Y{V"B`w
  238.  
  239. ____________________________________
  240. HARD:
  241. bracket test:
  242. 0001000 adds an empty string
  243. 0010 1 input string
  244. 1000 110 get lenght
  245. 1100 1 start repeat
  246. 1000 101 gets the last char from user input
  247. 1101 0 000 sets var 0 to current char
  248. 1101 1 000 loads var 0
  249. 0110 00100 swaps the answer and bracketstack
  250. 00011010001001 ")"
  251. 1000 001 tests if ")" != current char
  252. 000101000001111 jump line
  253. 1111 jumps if test was false
  254. 00011010001000 "("
  255. 0000 add last 2
  256. 1101 1 000 loads var 0
  257. 00011010111101 "]"
  258. 1000 001 tests if ")" != current char
  259. 000101000010110 jump line
  260. 1111 jumps if test was false
  261. 00011010111011 "["
  262. 0000 add last 2
  263. 1101 1 000 loads var 0
  264. 00011010001000 "("
  265. 1000 001 tests if "(" != current char
  266. 000101000100010 jump line
  267. 1111 jumps if test was false
  268. 1000 101 gets the last char from backetstack
  269. 1101 1 000 loads var 0
  270. 1001 1010 tests if the bracket matches what it should match
  271. 000101000100010 jump line
  272. 1111 jumpIf
  273. 000100101 stack 0
  274. 1011 EXIT
  275. 1101 1 000 loads var 0
  276. 00011010111011 "["
  277. 1000 001 tests if "[" != current char
  278. 000101000101110 jump line
  279. 1111 jumps if test was false
  280. 1000 101 gets the last char from backetstack
  281. 1101 1 000 loads var 0
  282. 1001 1010 tests if the bracket matches what it should match
  283. 000101000101110 jump line
  284. 1111 jumpIf
  285. 000100101 stack 0
  286. 1011 EXIT
  287. 0110 00010 swaps the answer and bracketstack
  288. 1100 0 ends repeat
  289. 0110 00010 swaps the answer and bracketstack back
  290. 0001 000 adds an empty string
  291. 1000 001 if both are not equal add 1
  292. 000101000110111 line 55
  293. 1111 jumpIf
  294. 0001 001 10 stack num 1
  295. 1011 EXIT
  296. 000100101 stack 0
  297. BYTES:00010000010110001101100110001011101000011011000011000100000110100010011000001000101000001111111100011010001000000011011000000110101111011000001000101000010110111100011010111011000011011000000110100010001000001000101000100010111110001011101100010011010000101000100010111100010010110111101100000011010111011100000100010100010111011111000101110110001001101000010100010111011110001001011011011000010110000110000100001000100000100010100011011111110001001101011000100101
  298. COMPILED: 2C=4R6@?myhC\,<@ofQY#@[E3fbi/4c,!0a%x>H-;N S1;PS?z=lwQp!Cx-DeGPy}OxE|D}
  299. V2 CODE: (@xV8NAL,0:)@B@_QH@-@:]@BbWf}Ax&B((HB^+xFbd7d{V!KN"*+OeV)pH}XEMbPPb((qOXFxE
  300. _______________
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement