Scratch for Java

ParityProbe()

Every value that has to read the same on the desktop and in the browser.

The two implementations of this library have drifted apart more than once, and always in a way no signature could catch: a transparency that counted the other way round, a getWidth() that measured the rotated bounding box instead of the costume, a hitbox reported in screen pixels rather than around the middle of the stage. Every one of those was found by hand, by running the same program twice and reading the two outputs side by side. This is that program, written down.

Nothing here may depend on timing, randomness or the frame rate - the browser runs it in a different loop and would disagree for reasons that are not drift.

The expected output lives in src/test/resources/parity/expected.txt. ./scripts/parity.sh checks the desktop against it, and scripts/parity-fixture.py generates the copy the online IDE runs as ScratchParityTest.java in its own test suite.

Syntax

Java

new ParityProbe()
ParityProbe()

Create Shareable URL

Select Sections