This file contains 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
// @ts-check | |
const {read} = require("../util/read") | |
const outputQueue = [] | |
const stdinQueue = [] | |
function dataReceiver(data) { | |
const value = +data.toString() | |
if (stdinQueue.length) stdinQueue.shift()(value) |
This file contains 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
const {read} = require("../util/read") | |
class SpaceJunk { | |
constructor(name) { | |
this.name = name | |
/** @type {SpaceJunk} */ | |
this.parent = null | |
this.children = [] | |
} |
This file contains 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
const {read} = require("../util/read") | |
class SpaceImage { | |
constructor(width, height) { | |
this.width = width | |
this.height = height | |
this.layers = [] | |
} | |
importPixels(pixels) { |
This file contains 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
// @ts-check | |
const {read} = require("../util/read") | |
const {permute} = require("../util/mult") | |
const {EventEmitter} = require("events") | |
class Connection extends EventEmitter { | |
constructor() { | |
super() | |
this.buffer = [] |