A random HDL brainstorm for Minecraft redstone.
module ComparatorClock(delay_ticks) {
default input toggle: 1
default output out: 1
component comp: Comparator(mode: "subtract")
wiring {
// Rol: a language transpiled to Lua for all you Lua syntax haters | |
// Overall the language is quite C-like | |
print("Hello, World!") | |
// Semicolons are not required, but can be used | |
print("Semi");print("colon") | |
// Idk about variable syntax, is similar to Kotlin | |
var a: Int = 1 |
char (arity) - desc | |
whitespace - nop | |
newline - Starts a new function | |
! (1) - (any) logical not | |
" - String literal | |
# - Misc digraph char | |
$ (1) - (any) reverse | |
% (2) - (num, num) b mod a, (str, any) replace % in a with b | |
& (2) - (num, num) bitwise AND |
import org.bukkit.util.noise.SimplexOctaveGenerator; | |
import org.junit.jupiter.api.Assertions; | |
import java.util.concurrent.CountDownLatch; | |
import java.util.concurrent.ThreadLocalRandom; | |
public class OctaveGeneratorThreadTest { | |
public static void main(String[] args) throws InterruptedException { | |
int threadCount = 500; // set this to the number of threads to use in testing |
""" | |
A minimalistic Turing machine I wrote for an assignment. | |
Has 4 commands: > (unconditional branch), + (add), x (halt), and ? (branch if zero). > adds to the current | |
tape location by x, where x is the number right after the command. + adds the number in absolute | |
position a to the number in absolute position b, one-indexed, where a and b are the two numbers | |
following the command. x stops the program and prints the contents of the tape. ? checks if the previous | |
number is zero, if it is, add x to the tape position, where x is the number following the command. | |
Sample multiplication program: > 7 c a b ? 4 > 3 x + 4 3 -1 + 14 5 > -13, where c is the result |
Map<Location, Map<String, String>> storage = new HashMap<>(); | |
try (MockedStatic<BlockStorage> bsMock = Mockito.mockStatic(BlockStorage.class)) { | |
bsMock.when(() -> BlockStorage.addBlockInfo(any(Block.class), anyString(), anyString())) | |
.then((Answer<Void>) a -> { | |
Block b = a.getArgument(0, Block.class); | |
storage.computeIfAbsent(b.getLocation(), k -> new HashMap<>()) | |
.put(a.getArgument(1), a.getArgument(2)); | |
return null; | |
} |