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
import "events" | |
import "json" | |
import "listUtil" | |
import "qa" | |
import "stringUtil" | |
import "tc" | |
import "textUtil" | |
Shape = {} | |
Shape.make = function(x, y) |
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
import "events" | |
import "json" | |
import "stringUtil" | |
import "tc" | |
Ellipse = {} | |
Ellipse.make = function(x, y, width, height, color=null, penSize=1) | |
if color == null then color == gfx.color | |
self.className = "Ellipse" | |
self.left = x - width / 2 |
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
import "tc" | |
import "stringUtil" | |
Ellipse = {} | |
Ellipse.make = function(x, y, width, height, color=null, penSize=1) | |
if color == null then color == gfx.color | |
self.left = x - width / 2 | |
self.bottom = y - height / 2 | |
self.width = width | |
self.height = height |
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
MIN_X = -10 | |
MAX_X = 10 | |
MIN_Y = -10 | |
MAX_Y = 10 | |
RANGE_X = MAX_X - MIN_X + 1 | |
RANGE_Y = MAX_Y - MIN_Y + 1 | |
// Transform grid coordinates into screen coordinates. | |
transform = function(x, y) |
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
// Metaballs / Marching Squares Demo | |
// https://jamie-wong.com/2014/08/19/metaballs-and-marching-squares/ | |
// https://jurasic.dev/marching_squares/ | |
import "tc" | |
GRID_RESOLUTION = 24 | |
PRINT_SAMPLES = false | |
SHOW_GRID = false | |
DRAW_CIRCLES = true | |
FILL_RECTS = false |
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
import "json" | |
import "stringUtil" | |
wikiApiUrl = "https://miniscript.org/w/api.php" | |
formatParams = function(params) | |
query = [] | |
for key in params.indexes | |
query.push "{0}={1}".fill([ key, params[key] ]) | |
end for |
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
// Play a familiar tune. | |
bpm = 200 | |
bps = bpm / 60 | |
spb = 1 / bps | |
notes = { | |
"R": 0, | |
"C4": 60, | |
"C5": 72, |
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
//// | |
// Weird experiment to see what Rust-style traits might look like in MiniScript. | |
//// | |
import "listUtil" | |
import "stringUtil" | |
PartialEq = {} | |
PartialEq.eq = function(other) | |
return refEquals(self, other) |
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
import "qa" | |
// Split a quoted string on a delimiter. | |
string.splitQuote = function(delim) | |
a = self.split("""") | |
b = [] | |
for n in a.indexes | |
if n % 2 == 0 then | |
b += a[n].trim.split(delim) | |
else |
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
import "qa" | |
Scenario = {} | |
Scenario.init = function(name) | |
self.name = name | |
return self | |
end function | |
Scenario.Given = {} |
NewerOlder