mirror of
https://github.com/exoticorn/curlywas.git
synced 2026-01-20 11:46:43 +01:00
26 lines
605 B
Plaintext
26 lines
605 B
Plaintext
import "env.memory" memory(4);
|
|
|
|
global mut randomState: i32 = 37;
|
|
|
|
fn random() -> i32 {
|
|
let state: i32;
|
|
randomState = (state := (
|
|
state := randomState ^ (randomState << 13)
|
|
) ^ (state >> 17)
|
|
) ^ (state << 5);
|
|
randomState * 625341585
|
|
}
|
|
|
|
fn seed(s: i32) {
|
|
randomState = (((s + !(s >> 31)) as i64 * 8445297036689579347i64) >> 31i64) as i32;
|
|
}
|
|
|
|
export fn tic(time: i32) {
|
|
let i: i32;
|
|
loop pixels {
|
|
seed(i + (time / 100) * 320);
|
|
i?120 = random();
|
|
branch_if (i := i + 1) < 320*256: pixels
|
|
}
|
|
}
|