base32-computer

所属分类:编程语言基础
开发工具:JavaScript
文件大小:0KB
下载次数:0
上传日期:2022-12-12 14:16:32
上 传 者sh-1993
说明:  一种组合编程语言的编程难题
(Programming puzzles for a made-up programming language)

文件列表:
.babelrc (64, 2021-07-27)
.eslintrc.json (899, 2021-07-27)
package.json (1081, 2021-07-27)
src/ (0, 2021-07-27)
src/components/ (0, 2021-07-27)
src/components/App.jsx (10940, 2021-07-27)
src/components/InstructionBlock.jsx (498, 2021-07-27)
src/index.html (301, 2021-07-27)
src/index.js (195, 2021-07-27)
src/styles/ (0, 2021-07-27)
src/styles/_vars.sass (661, 2021-07-27)
src/styles/fonts/ (0, 2021-07-27)
src/styles/fonts/TTCommons-Regular.eot (195088, 2021-07-27)
src/styles/fonts/TTCommons-Regular.ttf (194848, 2021-07-27)
src/styles/fonts/TTCommons-Regular.woff (79468, 2021-07-27)
src/styles/main.sass (4187, 2021-07-27)
src/tasks/ (0, 2021-07-27)
src/tasks/task0-add-the-inputs-i.js (249, 2021-07-27)
src/tasks/task1-multiply-the-inputs.js (281, 2021-07-27)
src/tasks/task2-hello-world.js (260, 2021-07-27)
src/tasks/task3-add-the-inputs-ii.js (310, 2021-07-27)
src/tasks/tasks.js (215, 2021-07-27)
src/util/ (0, 2021-07-27)
src/util/base32_computer.js (5107, 2021-07-27)
src/util/util.js (1790, 2021-07-27)
webpack.config.js (1328, 2021-07-27)
yarn.lock (318102, 2021-07-27)

# Base32 Computer Programming Puzzles #### Live at https://b32c.jsur.in/ The Base32 Computer reads and executes `b32 programs`. A `b32 program` is a string of characters made up of the characters in the standard base32 alphabet `ABCDEFGHIJKLMNOPQRSTUVWXYZ234567`. The Base32 Computer has 32 registers which it can read/write data to. Each register is identified by a character in the base32 alphabet and at the start of execution, all registers have the value `0`. The syntax for a `b32 program` follows the following structure: ``` [opcode][arg1][arg2][opcode][arg1][arg2][arg3][opcode][arg1]... ``` and there can be any amount of whitespace between each character. Each `(opcode, args)` pair form an instruction. Instructions are labeled by their index to be used by jump instructions. The first instruction has an index of `0` and the last instruction has an index of `n-1`, where `n` is the total number of instructions. List of opcodes: |Opcode|Instruction|#Args|Args|Description| |---|---|---|---|---| |`A`|Addition|3|`a1` `a2` `a3`| Stores the result of `a1` + `a2` in `a3` | |`S`|Subtraction|3|`a1` `a2` `a3`| Stores the result of `a1` - `a2` in `a3` | |`M`|Multiplication|3|`a1` `a2` `a3`| Stores the result of `a1` * `a2` in `a3` | |`N`|Logical Negation|2|`a1` `a2`| Stores the result of `not a1` in `a3` | |`X`|XOR|3|`a1` `a2` `a3`| Stores the result of `a1` XOR `a2` in `a3` | |`I`|Input|1|`a1`| Reads user input and stores it in `a1` | |`O`|Output (ASCII)|1|`a1`| Outputs `a1` as an ASCII value | |`V`|Output (Value)|1|`a1`| Outputs `a1` as an decimal value | |`L`|Less Than|3|`a1` `a2` `a3`| Stores the result of `a1 < a2` in `a3` | |`E`|Equals|3|`a1` `a2` `a3`| Stores the result of `a1 = a2` in `a3` | |`T`|Jump If True|2|`a1` `a2`| Jumps to the instruction at index `a2` if `a1` is nonzero | |`F`|Jump If False|2|`a1` `a2`| Jumps to the instruction at index `a2` if `a1` is zero | |`Q`|Quit|0|| Exits the program| Example program to add two user inputted numbers and output the result: ``` IA IB AABA VA ```

近期下载者

相关文件


收藏者