{"_id":"90deg","_rev":"4-38ec287bb9eb38a22201d4a6ced1d2f3","name":"90deg","dist-tags":{"latest":"0.2.2"},"versions":{"0.1.0":{"name":"90deg","version":"0.1.0","keywords":["90deg","oisc","esolang","turing-complete","turing-tarpit"],"author":{"name":"nguyenphuminh"},"license":"GPL-3.0","_id":"90deg@0.1.0","maintainers":[{"name":"xixdev","email":"nguyenphuminh09876543@gmail.com"}],"homepage":"https://github.com/nguyenphuminh/90deg#readme","bugs":{"url":"https://github.com/nguyenphuminh/90deg/issues"},"dist":{"shasum":"f8fc7903c66da49e06cf51d95c39bff13a4e7af3","tarball":"https://registry.npmjs.org/90deg/-/90deg-0.1.0.tgz","fileCount":4,"integrity":"sha512-UF64O1ATTyvjg51liWzpreeD9u9bWS/DYUkQNTbKjCONa01sZbwpCoZLtQT32EOxm9yocTp2JrWErN7UzKd3IQ==","signatures":[{"sig":"MEUCIQDTCprsIGWXLTAdpJ59EU5lfTc/Ovjwqp45uLlDNJclOAIgKCuh46nXFfdUXfNrajN8ia/Ois260wAT3UxERBO9LcY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":3274},"main":"90deg.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"xixdev","email":"nguyenphuminh09876543@gmail.com"},"repository":{"url":"git+https://github.com/nguyenphuminh/90deg.git","type":"git"},"_npmVersion":"10.7.0","description":"90deg is an OISC around vector dot product and addition","directories":{},"_nodeVersion":"20.12.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/90deg_0.1.0_1746587183619_0.7832842142111551","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"90deg","version":"0.2.0","keywords":["90deg","oisc","esolang","turing-complete","turing-tarpit"],"author":{"name":"nguyenphuminh"},"license":"GPL-3.0","_id":"90deg@0.2.0","maintainers":[{"name":"xixdev","email":"nguyenphuminh09876543@gmail.com"}],"homepage":"https://github.com/nguyenphuminh/90deg#readme","bugs":{"url":"https://github.com/nguyenphuminh/90deg/issues"},"dist":{"shasum":"2def3b36a4fd1d4dfd603fa440784d8900c4107e","tarball":"https://registry.npmjs.org/90deg/-/90deg-0.2.0.tgz","fileCount":6,"integrity":"sha512-R+4tN4AzmI16/cBf5/77x94c2OLYI/AhUrV0VZCzN/6gQ0U8TAAUai/gISYvpDFL6aSJ1RVkMcrWEUSc/4gnbQ==","signatures":[{"sig":"MEUCIQC2WtHK5Jhxh52YF+IEAhlkdgciAg80GsdSqivCjGYaCgIgUWdcF6sDhZRFS5TB6w8RIkEFTIw3iz5JV7KSpBzWqXU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":38821},"main":"90deg.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"xixdev","email":"nguyenphuminh09876543@gmail.com"},"repository":{"url":"git+https://github.com/nguyenphuminh/90deg.git","type":"git"},"_npmVersion":"10.7.0","description":"90deg is an OISC around vector dot product and addition","directories":{},"_nodeVersion":"20.12.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/90deg_0.2.0_1746846362766_0.5695804935485878","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"90deg","version":"0.2.1","keywords":["90deg","oisc","esolang","turing-complete","turing-tarpit","vm","cpu","interpreter","register","assembly","vector","esoteric-language","isa","maths","risc","fractran"],"author":{"name":"nguyenphuminh"},"license":"GPL-3.0","_id":"90deg@0.2.1","maintainers":[{"name":"xixdev","email":"nguyenphuminh09876543@gmail.com"}],"homepage":"https://github.com/nguyenphuminh/90deg#readme","bugs":{"url":"https://github.com/nguyenphuminh/90deg/issues"},"dist":{"shasum":"598e47c3151c61990a7240f5db0d4797bb59f4d2","tarball":"https://registry.npmjs.org/90deg/-/90deg-0.2.1.tgz","fileCount":6,"integrity":"sha512-Hq95AQqhVWlTgrs4k1GZc+II4qSUPKSXAMlTrMk0AUxGroYGHiq4h2AJ3qUv2TeIUypWWavGfBUeXoZSUY+vbw==","signatures":[{"sig":"MEUCIQDk4q8PyFj5Wd3JBNCVDOtTSHP8ocM8t0XJ+Uh+o+A5LQIgDmF75nBNIzvWeOtTAnp9amO1v3lrgf9z8jPs6h6c2n4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":40976},"main":"90deg.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"xixdev","email":"nguyenphuminh09876543@gmail.com"},"repository":{"url":"git+https://github.com/nguyenphuminh/90deg.git","type":"git"},"_npmVersion":"10.7.0","description":"90deg is an OISC around vector dot product and addition","directories":{},"_nodeVersion":"20.12.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/90deg_0.2.1_1747573481973_0.9725795891492621","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"name":"90deg","version":"0.2.2","description":"90deg is an OISC around vector dot product and addition","main":"90deg.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/nguyenphuminh/90deg.git"},"keywords":["90deg","oisc","esolang","turing-complete","turing-tarpit","vm","cpu","interpreter","register","assembly","vector","esoteric-language","isa","maths","risc","fractran"],"author":{"name":"nguyenphuminh"},"license":"Apache-2.0","bugs":{"url":"https://github.com/nguyenphuminh/90deg/issues"},"homepage":"https://github.com/nguyenphuminh/90deg#readme","_id":"90deg@0.2.2","_nodeVersion":"20.12.0","_npmVersion":"10.7.0","dist":{"integrity":"sha512-ekST2ZP5OQUWWwayoiC9N2+11iWzVcEt4FK8Npe8oZ6oi61EWsbkC4y0F6RAzeurmiF7v8OQbkFoTBndxKVwkA==","shasum":"423939899805ddd864e089b516a5c1cfd0c0f118","tarball":"https://registry.npmjs.org/90deg/-/90deg-0.2.2.tgz","fileCount":6,"unpackedSize":17189,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBzGrKWehLd6r1stHZAZ5k0CkRhhfTzQP+daQbTL8TFMAiEAjQzKDsDf++62p7QCw778vaZaBxcjV7Nf5sHIN4hwrPo="}]},"_npmUser":{"name":"xixdev","email":"nguyenphuminh09876543@gmail.com"},"directories":{},"maintainers":[{"name":"xixdev","email":"nguyenphuminh09876543@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/90deg_0.2.2_1760249651980_0.12092935049569431"},"_hasShrinkwrap":false}},"time":{"created":"2025-05-07T03:06:23.618Z","modified":"2025-10-12T06:14:12.327Z","0.1.0":"2025-05-07T03:06:23.813Z","0.2.0":"2025-05-10T03:06:02.956Z","0.2.1":"2025-05-18T13:04:42.189Z","0.2.2":"2025-10-12T06:14:12.145Z"},"bugs":{"url":"https://github.com/nguyenphuminh/90deg/issues"},"author":{"name":"nguyenphuminh"},"license":"Apache-2.0","homepage":"https://github.com/nguyenphuminh/90deg#readme","keywords":["90deg","oisc","esolang","turing-complete","turing-tarpit","vm","cpu","interpreter","register","assembly","vector","esoteric-language","isa","maths","risc","fractran"],"repository":{"type":"git","url":"git+https://github.com/nguyenphuminh/90deg.git"},"description":"90deg is an OISC around vector dot product and addition","maintainers":[{"name":"xixdev","email":"nguyenphuminh09876543@gmail.com"}],"readme":"# 90deg\r\n\r\n90deg is an OISC (one instruction set computer) based on perpendicular vectors, vector dot product, and vector addition.\r\n\r\n## Basics\r\n\r\nStart off with an nD vector (3D in this case, and that should be enough already) s(a, b, c) as the original state. Each 90deg command takes up 2n+1 parameters (7 in this case), with the first n params being the coordinates of the a vector, the next n params being the coordinates of the b vector, and the last param being a number d. Calculate dot product of s and a, if it is 0 (perpendicular), jump to the next command, otherwise add b to s and jump to command d. It halts simply when all dot products are 0 (no commands can be run) or enter an infinite loop with some conditions. Note that all values are unbounded signed integers.\r\n\r\nFor example, here is how to calculate 3+2:\r\n\r\n```\r\ns = (3, 2, 0)\r\n\r\n(1, 0, 0) (-1, 0, 1) 1\r\n(0, 1, 0) (0, -1, 1) 0\r\n```\r\n\r\nState changes:\r\n```\r\ns = (2, 2, 1)\r\ns = (1, 2, 2)\r\ns = (0, 2, 3)\r\ns = (0, 1, 4)\r\ns = (0, 0, 5)\r\n```\r\n\r\nAs we can see, the z coordinate is now 5 which is the result of 3+2.\r\n\r\n## Turing completeness\r\n\r\n### 2-counter machine\r\n\r\nTo prove that 90deg is turing complete, we can prove that it is able to simulate a 2-counter machine, which is turing complete.\r\n\r\nA 2-counter machine consists of:\r\n- Two unbounded integer registers.\r\n- INC(x) command to increment the value of register x.\r\n- DEC(x, i) command to decrement the value of register x if it is not zero and jump to command i, otherwise jump to the next command.\r\n\r\n### 90deg as a 2-counter machine\r\n\r\nA 3D vector s can already represent two registers with its coordinate x and y.\r\n\r\nThe DEC command can be implemented by calculating the dot product of vector s and vector a that has value 1 in the coordinate (register) we want to check and 0 in other coordinates. For example:\r\n```\r\ns(2, 1, 0) . a(1, 0, 0) = 2 * 1 + 0 + 0 = 2\r\ns(3, 0, 2) . a(0, 1, 0) = 0 + 0 * 1 + 0 = 0\r\n```\r\n\r\nA 90deg command adds the vector b to the vector s and jumps to some command i if the dot product is not zero. If it is zero, s is not modified and the program jumps to the next command. Thus, we can recreate DEC by making b's coordinates negative.\r\n\r\nThe INC command can be simulated by forcing the z coordinate of s to always be non-zero. For instance, you can define s as (a, b, 1), then calculate dot product of s and a(0, 0, 1). The result would always be non-zero, then you can add b(m, n, 0) to s to increment whatever registers you like.\r\n\r\n## The 90deg virtual machine\r\n\r\nThis repo also comes with a 90deg vm/interpreter in `90deg.js`. To use it, create another JS file:\r\n\r\n```js\r\nconst vm = require(\"./90deg\");\r\n\r\nvm.run(\r\n    // s vector\r\n    [ 3n, 2n, 0n ],\r\n    // code\r\n    [\r\n        1n, 0n, 0n, -1n, 0n, 1n, 0n,\r\n        0n, 1n, 0n, 0n, -1n, 1n, 0n\r\n    ],\r\n    // log per state change, default is true\r\n    true\r\n);\r\n```\r\n\r\nTo make it nD, you can simply increase the dimension (length) of the s vector (array) and the VM will adapt.\r\n\r\nNote that `vm.run` directly mutates the s vector and returns a reference to it as well.\r\n\r\n### NPM\r\n\r\nYou can use 90deg as an npm package. First, install:\r\n```\r\nnpm install 90deg\r\n```\r\n\r\nThen import:\r\n```js\r\nconst vm = require(\"90deg\");\r\n```\r\n\r\n### CDN\r\n\r\nOr just use 90deg in a browser:\r\n```html\r\n<script src=\"https://unpkg.com/90deg\"></script>\r\n```\r\n\r\n## Examples\r\n\r\nExample 90deg programs can be found in `./examples/`.\r\n\r\n## Copyrights and License\r\n\r\nCopyrights © 2025 Nguyen Phu Minh.\r\n\r\nThis project is licensed under the Apache 2.0 License.\r\n","readmeFilename":"README.md"}