diff --git a/SplitBit Test Manual.md b/SplitBit Test Manual.md index 44c2c57..a597f08 100644 --- a/SplitBit Test Manual.md +++ b/SplitBit Test Manual.md @@ -83,6 +83,11 @@ somewhere else, and the flight had to be flown again for nothing. A demo is a re somebody *did*, and on a machine one person is playing the number it arrived on is not part of that. +`Tests/input/landerDemo.pad` is the first fixture that was **played rather than written**: a +cyan-to-red cargo delivery in Lunar Porter, twenty five seconds of steering, recorded with +`--record-pad`. `video.sh` replays it and checks that the base answers with a *D*, which only +a delivery does. It is the only check that a cargo ever reaches anywhere. + It exists because some inputs cannot sensibly be written by hand. Flying a lander from one base to another is a few hundred frames of steering that has to arrive somewhere eight cells wide, and several attempts at authoring one by hand got within two columns and no closer. That diff --git a/start.keys b/Tests/input/landerDemo.keys similarity index 100% rename from start.keys rename to Tests/input/landerDemo.keys diff --git a/Tests/input/landerDemo.pad b/Tests/input/landerDemo.pad new file mode 100644 index 0000000..f64b7d3 Binary files /dev/null and b/Tests/input/landerDemo.pad differ diff --git a/Tests/video.sh b/Tests/video.sh index 4549abb..d4c830d 100755 --- a/Tests/video.sh +++ b/Tests/video.sh @@ -1758,6 +1758,35 @@ UNSAID="$(countColour "$BUILD/unsaid.ppm" f0f0f0)" && result ok "and opening the throttle wipes it" "the line went with the moment" \ || result no "and opening the throttle wipes it" "$UNSAID pixels of it still there" +# ---- A delivery, flown by hand and kept ---- +# +# THIS ONE WAS PLAYED RATHER THAN WRITTEN. Cyan base to red base, twenty five seconds of +# steering recorded with --record-pad and replayed here. Several attempts at authoring a +# flight like it by hand got within two columns and no closer; that is a piloting exercise +# rather than a test, and playing it once is the whole answer. +# +# What is checked is the FIRST LETTER of the message the base gives back. Delivered, Loaded, +# Nowhere and Not are 30, 22, 37 and 37 pixels of white in that cell, so a D is a delivery and +# nothing else is. Counting the whole message would pass on any message of the same length; +# comparing the picture would pass on nothing at all the next time a font changes. +# +# It is the only check that a cargo ever reaches anywhere, and it is the reason the recorder +# exists. +timeout 60 "$EMU" --fast --cycles 26000000 --keyboard "$ROOT/Tests/input/landerDemo.keys" \ + --pad "$ROOT/Tests/input/landerDemo.pad" --screen "$BUILD/demo.ppm" \ + --disk "$ROOT/Tests/build/disks/cosmos.img" --ram-disk 2048 \ + "$BUILD/cosmos.bin" > "$BUILD/demo.out" 2>&1 || true +FIRST="$(python3 -c " +d = open('$BUILD/demo.ppm', 'rb').read() +px = d[d.index(b'255\n') + 4:] +w, white = 320, bytes.fromhex('f0f0f0') +print(sum(1 for x in range(8) for y in range(8, 16) + if px[(y * w + x) * 3:(y * w + x) * 3 + 3] == white)) +" 2>/dev/null || echo -1)" +[ "$FIRST" = "30" ] \ + && result ok "a flown delivery arrives" "the base answered with a D" \ + || result no "a flown delivery arrives" "$FIRST pixels in the first cell, and a D is 30" + # ---- The landing pads, carved and coloured ---- # # A random walk does not leave flat ground and a lander wants some, so four pads are carved diff --git a/demo.pad b/demo.pad deleted file mode 100644 index 0142fcb..0000000 Binary files a/demo.pad and /dev/null differ