Update flipflop.js

This commit is contained in:
felixs-alt 2023-09-26 12:05:49 +02:00 committed by GitHub
parent 7c55edc462
commit b90b6d90e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 10 deletions

View File

@ -13,15 +13,18 @@ elements.flipflop = {
let Powerstate = pixel.powerst
let Output = pixelMap[pixel.x+1][pixel.y]
let Input = pixelMap[pixel.x-1][pixel.y]
Output.charge = 0
if (Powerstate == "true" && Input.charge > 0.9) {
Powerstate == "false"
pixel.color = "#CF300D"
Output.charge = 0
} else if (Powerstate == false && Input.charge < 0.9) {
Powerstate == true
pixel.color = "#94CF0D"
Output.charge = 5
}
if (isEmpty(Output.x,Output.y) == false && isEmpty(Input.x,Input.y)){
Output.charge = 0
if (Powerstate == "true" && Input.charge > 0.9) {
Powerstate == "false"
pixel.color = "#CF300D"
Output.charge = 0
} else if (Powerstate == false && Input.charge < 0.9) {
Powerstate == true
pixel.color = "#94CF0D"
Output.charge = 5
}
}
}
};