This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --!strict | |
| -- Matrices are in row-major order | |
| -- magicoal_nerb :3 | |
| local function entry(a: number, b: number, n: number): number | |
| return (a-1)*n + b | |
| end | |
| local function forwardSubstitution(L: { number }, b: { number }): { number } | |
| -- Let A = LU. Ax = b <=> LUx = b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --!strict | |
| -- deque; could be used as an object pool | |
| -- magicoal_nerb :3 | |
| local Deque = {} | |
| export type Deque<T> = { | |
| elements: { T }, | |
| capacity: number, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --!strict | |
| local kOp = { ['v'] = 1, ['^'] = 2, ['>'] = 3, ['x'] = 4, ['='] = 5 } | |
| export type OpCode = { ret: number, a: number, b: number, op: number } | |
| export type State = { | |
| var: (string) -> number, | |
| reg: () -> number, | |
| emit: (ret: number, a: number, b: number, op: number) -> (), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --!nolint | |
| local FLAG_BRANCH = 1 | |
| local FLAG_LEAF = 0 | |
| local Bvh = {} | |
| Bvh.__index = Bvh | |
| local function safe(x) | |
| -- safe epsilon |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --!strict | |
| local function decodePair(pair: number): (number, number) | |
| -- Get the vertex A and B | |
| return bit32.rshift(pair, 16), bit32.band(pair, 0xFFFF) | |
| end | |
| local function encodePair(a: number, b: number): number | |
| -- Encode A and B | |
| return bit32.bor(bit32.lshift(a, 16), b) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| public class JsonVariant { | |
| // Referent | |
| public JsonObject referent = null; | |
| // Floating point number | |
| public float number; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| // Xml element | |
| public class XmlElement { | |
| // Current XML tag | |
| public string tag; | |
| // Current XML body | |
| public string body; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --!strict | |
| -- Animate.lua | |
| -- magicoal_nerb/poopbarrel :3 | |
| local AnimateScriptKeymap: {[string]: string} = { | |
| Climbing = "climb", | |
| Freefall = "fall", | |
| Running = "run", | |
| Jumping = "jump", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --!strict | |
| local Queue = require("./Queue") | |
| local Octree = {} | |
| Octree.__index = Octree | |
| export type OctreeNode = { | |
| -- nodes expect 8 children if childIndex != 0 | |
| min: vector, | |
| max: vector, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --!strict | |
| -- Buffer | |
| -- magicoal_nerb :P | |
| local Buffer = {} | |
| Buffer.__index = Buffer | |
| export type Buffer = typeof(setmetatable({} :: { | |
| data: buffer, |
NewerOlder