simon-git: puzzles (main): Ben Harris
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Fri Oct 21 00:18:16 BST 2022
TL;DR:
e29d8a3 Add an assertion to check the format of encoded parameters
9f2eef8 Add assertions that game descriptions consist only of printable ASCII.
304796f Hex-encode non-ASCII random seeds in save files
7f4d038 Assert that everything written to a save file is printable ASCII
0ce67c7 Document the asserted printable ASCII nature of many strings
1249102 Update comment on parameter string formats in documentation
Repository: https://git.tartarus.org/simon/puzzles.git
On the web: https://git.tartarus.org/?p=simon/puzzles.git
Branch updated: main
Committer: Ben Harris <bjh21 at bjh21.me.uk>
Date: 2022-10-21 00:18:16
commit e29d8a3ecad734967cdcf2d4ce222ab27e9c524b
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=e29d8a3ecad734967cdcf2d4ce222ab27e9c524b;hp=dbbe9d37500219b61132266029c1d8f42378c01c
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Sat Oct 15 20:46:28 2022 +0100
Add an assertion to check the format of encoded parameters
Whenever the midend calls encode_params, it also checks that the
result is a printable ASCII string that doesn't contain '#' or ':'.
Parameter strings are embedded in save files, so they have to fit within
ASCII. They can't contain '#' or ':' because those delimit the
parameter section of a game ID. Nothing explicitly says they can't
contain control characters, but those would be a particularly egregious
violation of the recommendation that parameter strings be easy to type
into a shell.
midend.c | 36 ++++++++++++++++++++++++------------
1 file changed, 24 insertions(+), 12 deletions(-)
commit 9f2eef876275a451b015c22961130b2e507ddd49
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=9f2eef876275a451b015c22961130b2e507ddd49;hp=e29d8a3ecad734967cdcf2d4ce222ab27e9c524b
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Sat Oct 15 21:25:08 2022 +0100
Add assertions that game descriptions consist only of printable ASCII.
That they are ASCII is implied by their inclusion in save files.
Nothing requires an absence of control characters, but it seems polite
to make them slightly readable.
midend.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
commit 304796f9f184a783d0af21e445c690ed69de048b
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=304796f9f184a783d0af21e445c690ed69de048b;hp=9f2eef876275a451b015c22961130b2e507ddd49
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Mon Oct 17 00:56:37 2022 +0100
Hex-encode non-ASCII random seeds in save files
The developer documentation claims that save files are long ASCII
strings. This is mostly true, but there's nothing stopping a user
from entering non-ASCII characters as random seeds. The ASCII
property of save files is useful, so encode seeds in hex before
writing them unless they consist only of printable ASCII characters.
Hex-encoded seeds are written under a new key, HEXSEED, to distinguish
them from unencoded seeds. This means that old versions of the code
won't be able to load encoded seeds, but that's not a great loss:
seeds aren't generally portable between versions anyway.
midend.c | 32 ++++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
commit 7f4d038258d2bd585a0dce87177bf429d168ffb5
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=7f4d038258d2bd585a0dce87177bf429d168ffb5;hp=304796f9f184a783d0af21e445c690ed69de048b
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Mon Oct 17 00:59:18 2022 +0100
Assert that everything written to a save file is printable ASCII
Apart from the newlines of course.
midend.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
commit 0ce67c7c3fb914d3d2d34487a2a60b7e948573a0
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=0ce67c7c3fb914d3d2d34487a2a60b7e948573a0;hp=7f4d038258d2bd585a0dce87177bf429d168ffb5
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Wed Oct 19 09:04:06 2022 +0100
Document the asserted printable ASCII nature of many strings
The exception is the random seed string, which we lightly document as
non-ASCII.
devel.but | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
commit 12491021d0541ded9f8f160a15b886a36e5aa8ac
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=12491021d0541ded9f8f160a15b886a36e5aa8ac;hp=0ce67c7c3fb914d3d2d34487a2a60b7e948573a0
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Wed Oct 19 09:04:55 2022 +0100
Update comment on parameter string formats in documentation
Net can have non-alphanumeric characters in its parameter strings. Both
"5x5b0.1" and "5x5b1e-05" are valid parameter strings generated by Net.
So only "most" puzzles use alphanumeric parameter strings.
devel.but | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
More information about the tartarus-commits
mailing list