Created
May 22, 2022 10:57
-
-
Save line-o/7cb0ec335316b4531807133527345c88 to your computer and use it in GitHub Desktop.
GPN20 display hack
This file contains hidden or 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
let tx = document.getElementById("text-input") | |
let h = 2 | |
let state = Array(24).fill([h, '_']) | |
let c = ['/', '_', '\\'] | |
let interval | |
function step () { | |
let direction = Math.floor(Math.random() * 2.9999) - 1 | |
let d = Math.min(3, Math.max(0, h+direction)) | |
state.shift() | |
let uuu = c[d-h +1] | |
state.push([h, uuu]) | |
h = d | |
tx.value = render(state) | |
updateDisplay() | |
} | |
function render(state) { | |
let asdf = Array(4).fill(null) | |
let buuu = asdf.map(_ => Array(24).fill(' ')) | |
for (let index in state) { | |
let arr = state[index] | |
let realh = arr[0]+(arr[1] == '\\') | |
buuu[realh][index] = arr[1] | |
realh +=1 | |
for (;realh<4;realh++) { | |
buuu[realh][index] = '8' | |
} | |
} | |
return buuu.map(a => a.join('')).join('\n') | |
} | |
int = setInterval(step, 250) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment