| History log of /src/games/cgram |
| Revision | Date | Author | Comments |
| 1.3 | 21-Feb-2021 |
rillig | cgram: WARNS=6, use int for all coordinates
Eliminate some frequently occurring subexpressions during substitution.
No functional change, assuming that fortune(6) always spits out less than 2 gigacharacters of text.
|
| 1.2 | 21-Feb-2021 |
rillig | cgram: adjust style to survive lint's strict bool mode
The biggest change is the return type of substitute(). Before, 0 meant success, now false means failure.
No functional change.
|
| 1.1 | 04-Aug-2013 |
dholland | branches: 1.1.4; 1.1.8; Add a curses gizmo for solving Sunday-paper-type cryptograms based on substitution ciphers. It gets the cleartext from fortune. I wrote this some years ago for my own amusement; a couple people have suggested that I should import it.
Approved only by groo, so I'm going to wait a couple days to hook it to the build in case anyone demands it be removed again...
|
| 1.1.8.2 | 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
| 1.1.8.1 | 04-Aug-2013 |
tls | file Makefile was added on branch tls-maxphys on 2014-08-20 00:00:22 +0000
|
| 1.1.4.2 | 22-May-2014 |
yamt | sync with head.
for a reference, the tree before this commit was tagged as yamt-pagecache-tag8.
this commit was splitted into small chunks to avoid a limitation of cvs. ("Protocol error: too many arguments")
|
| 1.1.4.1 | 04-Aug-2013 |
yamt | file Makefile was added on branch yamt-pagecache on 2014-05-22 11:36:22 +0000
|
| 1.4 | 29-Apr-2021 |
rillig | cgram: in hinting mode, show all correct characters in bold face
For almost solved cryptograms, this makes the punctuation stand out less, helping to focus on the missing letters.
|
| 1.3 | 22-Apr-2021 |
wiz | cgram: allow providing an input file instead of the random fortune
|
| 1.2 | 04-Aug-2013 |
wiz | branches: 1.2.4; 1.2.8; Add RCS Id.
|
| 1.1 | 04-Aug-2013 |
dholland | Add a curses gizmo for solving Sunday-paper-type cryptograms based on substitution ciphers. It gets the cleartext from fortune. I wrote this some years ago for my own amusement; a couple people have suggested that I should import it.
Approved only by groo, so I'm going to wait a couple days to hook it to the build in case anyone demands it be removed again...
|
| 1.2.8.2 | 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
| 1.2.8.1 | 04-Aug-2013 |
tls | file cgram.6 was added on branch tls-maxphys on 2014-08-20 00:00:22 +0000
|
| 1.2.4.2 | 22-May-2014 |
yamt | sync with head.
for a reference, the tree before this commit was tagged as yamt-pagecache-tag8.
this commit was splitted into small chunks to avoid a limitation of cvs. ("Protocol error: too many arguments")
|
| 1.2.4.1 | 04-Aug-2013 |
yamt | file cgram.6 was added on branch yamt-pagecache on 2014-05-22 11:36:22 +0000
|
| 1.30 | 10-May-2023 |
rillig | cgram: replace comments with code
No binary change.
|
| 1.29 | 12-Jun-2022 |
rillig | cgram: allow cursor navigation with KEY_BEG as well
|
| 1.28 | 14-May-2022 |
rillig | cgram: clear bottom line of the screen at the end
Previously, the prompt line of the shell overwrote only part of the prompt of cgram, the rest was still visible.
|
| 1.27 | 28-Mar-2022 |
rillig | cgram: define a word as a sequence of letters, not non-whitespace
Pressing Tab or Shift+Tab now advances to the next letter that could be substituted, it no longer stops at punctuation or digits. Since only letters are scrambled, these are most interesting to be edited.
|
| 1.26 | 29-Oct-2021 |
nia | cgram(6): realloc(x * y) -> reallocarr
|
| 1.25 | 28-May-2021 |
dholland | I don't see any code I wrote left in here.
|
| 1.24 | 28-May-2021 |
dholland | Restore return value of main, arbitrarily thrown away in -r1.4.
|
| 1.23 | 01-May-2021 |
rillig | branches: 1.23.2; cgram: rename local functions
The word 'cleanup' should have been named clean_up all along, but 'done' is even shorter.
No functional change.
|
| 1.22 | 29-Apr-2021 |
rillig | cgram: in hinting mode, show all correct characters in bold face
For almost solved cryptograms, this makes the punctuation stand out less, helping to focus on the missing letters.
|
| 1.21 | 25-Apr-2021 |
rillig | cgram: use ASCII-only implementation of <ctype.h> functions
The function 'encode' already assumes that all letter characters are contiguous and that there are only 26 letters of each case. At the moment, cgram cannot handle UTF-8 anyway since it reads the input byte-wise, assuming that each byte is exacty one character.
|
| 1.20 | 25-Apr-2021 |
rillig | cgram: provide usage on incorrect invocation
|
| 1.19 | 25-Apr-2021 |
rillig | cgram: conform to lint's strict bool mode, KNF
|
| 1.18 | 22-Apr-2021 |
wiz | cgram: allow providing an input file instead of the random fortune
|
| 1.17 | 26-Feb-2021 |
rillig | cgram: don't beep if the window is resized
|
| 1.16 | 26-Feb-2021 |
rillig | cgram: place the 'solved' marker nearer to the text
This way, it cannot be overlooked as easily as before. It also doesn't change the position of the keyboard help text anymore. Only if there is not enough space, the 'solved' marker is put into the bottom line.
|
| 1.15 | 26-Feb-2021 |
rillig | cgram: make the 'solved' stand out more
Suggested by Weitian LI via [1].
[1] https://github.com/NetBSD/src/commit/efec6410b2b5a736
|
| 1.14 | 22-Feb-2021 |
rillig | cgram: fix assertion when substituting at the end of the longest line
Reported by Weitian LI via GitHub.
Contrary to the patch suggested in [1], still allow the cursor to be placed to the very right of the text in a line since that is the usual behavior of text editors.
Split the function substitute() into two parts: one that handles the curses-specific part of checking whether a substitution is possible at the current cursor position, and one that performs the actual substitution. Only the latter is kept in the code section for the string manipulation functions, the other is moved to the section for curses code. Having all the curses code in one place reduces the places that call beep(). Previously, as well as now, there is a single beep per invalid key before, but that was not obvious from the previous code.
[1]: https://github.com/DragonFlyBSD/DragonFlyBSD/commit/18d09f18cf4c
|
| 1.13 | 22-Feb-2021 |
rillig | cgram: add advanced cursor movement with tab, shift+tab, return
|
| 1.12 | 22-Feb-2021 |
rillig | cgram: properly handle input errors
On both NetBSD and Cygwin, a missing /usr/bin/fortune would previously continue since popen does not return an error (as /bin/sh is found and can be executed), so the next chance to catch an error is pclose. At that point, the shell has already printed an informative error message about what happened (or what didn't happen), so that cgram does not need to print an error by itself.
|
| 1.11 | 21-Feb-2021 |
rillig | cgram: allow navigation with KEY_PPAGE and KEY_NPAGE
|
| 1.10 | 21-Feb-2021 |
rillig | cgram: rewrite completely, fixing bugs and style
Fixed bugs:
Do not consider the puzzle solved if all letters in the visible area are substituted correctly. To be properly solved, the whole puzzle must be solved, even those parts that are currently off-screen.
Never place the cursor at the very right edge of the screen since that does not work well with some terminals. The maximum valid x coordinate is COLS - 1.
Add horizontal scrolling. Make all coordinate handling symmetric in regard to the horizontal and vertical axes. Previously, lines longer than 80 characters could not be seen on the screen.
Improvements:
Remove the arbitrary limit of 128 characters per line. Even if fortune(6) may never generate such long lines, the code is easy enough to adapt to other sources.
Properly clean up the allocated memory. Previously, only the string arrays were freed but not the strings themselves.
Stylistic:
Add RCS ID.
Fix ctype functions in lint's strict bool mode.
Avoid excessive calls to strlen whenever the cursor moves. Given that the whole screen is redrawn every time a key is pressed, this is an unnecessary optimization, but the code smelled nevertheless.
|
| 1.9 | 21-Feb-2021 |
rillig | cgram: WARNS=6, use int for all coordinates
Eliminate some frequently occurring subexpressions during substitution.
No functional change, assuming that fortune(6) always spits out less than 2 gigacharacters of text.
|
| 1.8 | 21-Feb-2021 |
rillig | cgram: consistently use char for characters
Having to convert back and forth between char, unsigned char and int is confusing. Just stay with char, until the support for wide characters is added.
No functional change.
|
| 1.7 | 21-Feb-2021 |
rillig | cgram: fix undefined behavior when pressing function keys
The key codes for function keys are outside of the "range representable by an unsigned char". This resulted in parts of the screen being cleaned.
|
| 1.6 | 21-Feb-2021 |
rillig | cgram: adjust style to survive lint's strict bool mode
The biggest change is the return type of substitute(). Before, 0 meant success, now false means failure.
No functional change.
|
| 1.5 | 21-Feb-2021 |
rillig | cgram: sort includes
|
| 1.4 | 21-Feb-2021 |
rillig | cgram: indent
With manual corrections afterwards:
- indent removes empty lines between statement and declaration. This had been a syntax error in C90, since C99 this is common style and should be accepted by indent.
- indent didn't format the first line of main for whatever reason, did that manually.
- indent removed the empty line above the '/////' separators. It should have left these empty lines as-is.
|
| 1.3 | 21-Feb-2021 |
rillig | cgram: fix Home key for cursor navigation
Reported by liweitianux via GitHub.
|
| 1.2 | 02-Jul-2020 |
rillig | cgram(6): use standard cursor keys, use standard shuffle algorithm
The previous shuffle algorithm asked for 100 random numbers, on average. The new algorithm asks exactly for 26 random numbers.
Curses predefines numeric constants for keys, and there is no apparent reason not to use these standard keys for cursor movement.
|
| 1.1 | 04-Aug-2013 |
dholland | branches: 1.1.4; 1.1.8; Add a curses gizmo for solving Sunday-paper-type cryptograms based on substitution ciphers. It gets the cleartext from fortune. I wrote this some years ago for my own amusement; a couple people have suggested that I should import it.
Approved only by groo, so I'm going to wait a couple days to hook it to the build in case anyone demands it be removed again...
|
| 1.1.8.2 | 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
| 1.1.8.1 | 04-Aug-2013 |
tls | file cgram.c was added on branch tls-maxphys on 2014-08-20 00:00:22 +0000
|
| 1.1.4.2 | 22-May-2014 |
yamt | sync with head.
for a reference, the tree before this commit was tagged as yamt-pagecache-tag8.
this commit was splitted into small chunks to avoid a limitation of cvs. ("Protocol error: too many arguments")
|
| 1.1.4.1 | 04-Aug-2013 |
yamt | file cgram.c was added on branch yamt-pagecache on 2014-05-22 11:36:22 +0000
|
| 1.23.2.1 | 31-May-2021 |
cjep | sync with head
|
| 1.1 | 04-Aug-2013 |
dholland | branches: 1.1.4; 1.1.8; Add a curses gizmo for solving Sunday-paper-type cryptograms based on substitution ciphers. It gets the cleartext from fortune. I wrote this some years ago for my own amusement; a couple people have suggested that I should import it.
Approved only by groo, so I'm going to wait a couple days to hook it to the build in case anyone demands it be removed again...
|
| 1.1.8.2 | 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
| 1.1.8.1 | 04-Aug-2013 |
tls | file pathnames.h was added on branch tls-maxphys on 2014-08-20 00:00:22 +0000
|
| 1.1.4.2 | 22-May-2014 |
yamt | sync with head.
for a reference, the tree before this commit was tagged as yamt-pagecache-tag8.
this commit was splitted into small chunks to avoid a limitation of cvs. ("Protocol error: too many arguments")
|
| 1.1.4.1 | 04-Aug-2013 |
yamt | file pathnames.h was added on branch yamt-pagecache on 2014-05-22 11:36:22 +0000
|