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 numpy as np | |
from random import shuffle | |
from matplotlib import pyplot as plt | |
class Simulation: | |
""" | |
""" | |
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
incdec = "++" | "--" ; | |
unary = "-" | "~" | "!" | "*" | "&" ; | |
binary = "|" | "&" | ["#"] rel | "%" ; | |
rel = "==" | "!=" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | "+" | "-" | "*" | "/" ; | |
digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ; |
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
local RESERVED = { | |
BLOCK_START = { | |
DO = "do", | |
ELSE = "else", | |
ELSEIF = "elseif", | |
FOR = "for", | |
FUNCTION = "function", | |
IF = "if", | |
REPEAT = "repeat", | |
THEN = "then", |
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
effect give @a[gamemode=adventure] jump_boost 1000000 128 true | |
effect clear @a[gamemode=!adventure] jump_boost |
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
from itertools import * | |
for i in count(start, step): | |
for i in cycle(seq): | |
for i in repeat(elem, n): | |
for i in accumulate(seq): | |
for i in accumulate(seq, operator.mul): | |
for i in chain(): | |
for i in dropwhile(lambda x: x, seq): |
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
local Tokens = { | |
{ | |
type = "whitespace", | |
patterns = { | |
"%s+" | |
} | |
}, | |
{ | |
type = "comment", | |
patterns = { |
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
local Tokens = { | |
LBRACE = "{", RBRACE = "}", LBRACK = "[", LPAREN = "(", | |
RBRACK = "]", RPAREN = ")", LSHIFT = "<<", RSHIFT = ">>", | |
BAND = "&", BNOT = "~", BOR = "|", LENGTH = "#", | |
PLUS = "+", MINUS = "-", TIMES = "*", POW = "^", | |
DIV = "/", IDIV = "//", MOD = "%", EQUALS = "=", | |
DOT = ".", DDOT = "..", DDDOT = "...", COLON = ":", | |
EQ = "==", NE = "~=", QUOTE = "'", QQUOTE = '"', | |
LE = "<=", GE = ">=", LT = "<", GT = ">", | |
AND = "and", BREAK = "break", DO = "do", ELSE = "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
scoreboard players add @e[type=armor_stand,x=1000,y=175,z=1000,distance=..100] ticks 1 | |
execute at @e[type=armor_stand,x=1000,y=175,z=1000,distance=..100,scores={ticks=30..}] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:brick",Count:1b}} | |
scoreboard players add @e[x=1000,y=175,z=1000,distance=..100,type=armor_stand,scores={ticks=30..}] bronze 1 | |
scoreboard players reset @e[x=1000,y=175,z=1000,distance=..100,type=armor_stand,scores={ticks=30..}] ticks | |
execute at @e[type=armor_stand,x=1000,y=175,z=1000,distance=..100,scores={bronze=8..}] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:iron_ingot",Count:1b}} | |
scoreboard players add @e[x=1000,y=175,z=1000,distance=..100,type=armor_stand,scores={bronze=8..}] iron 1 | |
scoreboard players reset @e[x=1000,y=175,z=1000,distance=..100,type=armor_stand,scores={bronze=8..}] bronze |
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
/* Simulation LCR */ | |
float x, x1, x2, y, b, c, delta, asq, bsq, u, v, g, d, lsq, rsq, error, count; | |
float pos[] = new float[2]; | |
int t; | |
void setup() { | |
sample(); | |
size(800, 800); |
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
/* Simulation NSWE */ | |
float x, y, alpha, beta, alphasq, betasq, lambda, asq, bsq, u, v, error, avg, maxerror; | |
float[] pos = new float[2]; | |
int t; | |
void setup() { | |
sample(); | |
size(800, 800); |
NewerOlder