Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow 'alternative' letters #93

Closed
MaheshVelankar opened this issue Nov 5, 2023 · 12 comments
Closed

Allow 'alternative' letters #93

MaheshVelankar opened this issue Nov 5, 2023 · 12 comments

Comments

@MaheshVelankar
Copy link

MaheshVelankar commented Nov 5, 2023

Some words have alternative spellings. (I am not expert on any language but examples could be gray/grey or show/shew etc ... correct me if wrong) In Sanskrit based words in Indian languages word like 'कोश' can be written either as 'कोश' or 'कोष' (meaning a collection or a treasury). The setter may wish to allow both the alternative letters as acceptable.

Is there any way to achieve this in exolve. If it is, pl let me know. If it is not there, I suggest you may allow '/' between alternative letters (like 'श/ष') so that both can be considered when evaluating.

Thanks

@viresh-ratnakar
Copy link
Owner

viresh-ratnakar commented Nov 6, 2023

This seems like a useful feature. It will probably get used quite rarely, but I think it's worth adding, especially as it would not add too much code complexity. I'll add it, hopefully soon.

Sometimes the alternative letters for cells go together. In the sense that the crossword might have two distinct solutions (here's the famous example). I'll probably add support for that scenario too.

@viresh-ratnakar
Copy link
Owner

This is what I'm implementing (excerpt from my change to README.md). PTAL and comment here if you think it needs tweaking. @criptik

Alternative letters

Sometimes you would want to permit alternative spellings of some words. You
can do that by using one or more exolve-alternatives sections. Each such
single-line section has one or more space-separated entries that specify
alternative letters for specific cells (identified using the
extended chessboard notation). Example:

  exolve-width: 7
  exolve-height: 3
  exolve-grid:
    IDOLISE
    O.....V
    UTILISE
  exolve-alternatives: f1:Z
  exolve-alternatives: r3c6:Z

Both S and Z will be allowed by "Check this" and "Check all!", in
IDOLISE/IDOLIZE and UTILISE/UTILIZE. Similarly, "Reveal this" and "Reveal all!"
will not change any letter that the solver might have entered in a cell, if
it's listed as an alternative for that cell.

If an exolve-alternatives section has more than one cell, then it is treated
as an all-or-nothing group. For example, if the above puzzle had this
additional line:

  exolve-alternatives: r1c2:P r1c3:G r1c4:R r1c5:A r1c6:D r3c2:N r3c3:T r3c4:E r3c5:N r3c6:S

The above says that there is an alternative solution to the puzzle, in which 1a
is INTENSE and 3a is UPGRADE. This can be used to craft puzzles that might have
two (or more!) distinct solutions, such as this
famous example.
Note that every cell that is forced must be explicitly listed in a group, if
it is also a part of another group. Thus, the r3c6 cell has to be included in
the third exolve-alternatives line (even though it is S in both IDOLISE and
INTENSE), to prevent it from being allowed to be Z when the INTENSE/UPGRADE
solution is used.

Revealed in-clue solutions will include all possible solutions for a clue.
The solutions where some exolve-alternatives groups are used will be
shown with a superscript that is a comma-separated list of all group numbers
used in crafting that alternative. For example, 1a will show "IDOLISE,
IDOLIZE2, INTENSE3" and 3a will show "UTILISE,
UTILIZE1, UPGRADE3".

@criptik
Copy link

criptik commented Dec 18, 2024 via email

@MaheshVelankar
Copy link
Author

MaheshVelankar commented Dec 18, 2024 via email

@viresh-ratnakar
Copy link
Owner

I've finished implementing this. Still testing a bit more though. I'll probably check it in tomorrow.

However, I've made the implementation available in my "dev" directory. You can try these examples or try making your own puzzles (and let me know if you find any issues or have any tweak-ideas!).

https://viresh-ratnakar.github.io/dev/test-farrell-quantum.html
https://viresh-ratnakar.github.io/dev/test-alternatives.html
https://viresh-ratnakar.github.io/dev/exolve-m.js

I made some changes to the draft README (mainly added some details, but also added a couple of constraints). Here's the updated README section.

Alternative letters

Sometimes you would want to permit alternative spellings of some words. You
can do that by using one or more exolve-alternatives sections. Each such
single-line section has one or more space-separated entries that specify
alternative letters for specific cells (identified using the
extended chessboard notation). Example:

  exolve-width: 7
  exolve-height: 3
  exolve-grid:
    OXIDISE
    U.....V
    REALISE
  exolve-alternatives: r1c6:Z
  exolve-alternatives: r3c6:Z

Both S and Z will be allowed by "Check this" and "Check all!", in
OXIDISE/OXIDIZE (1a) and REALISE/REALIZE (3a). Similarly, "Reveal this" and
"Reveal all!" will not change any letter that the solver might have entered in
a cell, if it's listed as an alternative for that cell.

If an exolve-alternatives section has more than one cell, then it is treated
as an all-or-nothing group. For example, we can add this line to the above:

  exolve-alternatives: r2c1:A r2c7:Y

Here, there is an alternative solution to the puzzle in which 1d is OAR and
2d is EYE. This can be used to craft puzzles that might have
two (or more!) distinct solutions, such as this famous example by Jeremiah Farrell.

We disallow specifying the same cell in more than one exolve-alternatives
section. The reason is to avoid the possibility of puzzles where the solver
may reach a dead-end conflict in choices from two groups. Dealing with such
conflicts would have required adding code complexity as well as user interface
complexity.

The above way of specifying alternatives, with the non-duplicated-cell
constraint just described, means that you cannot specify more than one
alternative for a cell. We think that's reasonable, but if someone comes
up with an interesting puzzle in which more than one alternative is warranted
for some cell, please let us know and we can consider supporting that scenario.

Revealed in-clue solutions will include all possible solutions for a clue.
The solutions where some exolve-alternatives groups are used will be
shown with a superscript that is a comma-separated list of all group numbers
used in crafting that alternative. For example, 1a will show "OXIDISE,
OXIDIZE2", and 3a will show "REALISE, REALIZE1".
The revealed in-clue solutions also show the following help-text when hovered
over:

This is an alternative solution to the clue. Clicking on it
will set any currently visible letters in it to this variant. If
the setter has created an alternative solution group with more than one
cell (group numbers are shown in superscripts of solution variants)
then clicking will set all revealed visible letters in the group to
reflect this variant.

As described in the above help-text, clicking on any variant will set
all currently visible revealed cells to the values implied by the
alternatives groups used in that variant.

We disallow using exolve-alternatives when there ar diagramless cells or
when any cell does not have a solution. We disallow more than 3 distinct groups
of alternatives within any single clue (as it's an unlikely scenario and the
listing of all possible solutions would be too long).

@viresh-ratnakar
Copy link
Owner

v1.59 has been checked in, and this is now supported as described above.

@MaheshVelankar
Copy link
Author

MaheshVelankar commented Dec 22, 2024 via email

@criptik
Copy link

criptik commented Dec 22, 2024 via email

@criptik
Copy link

criptik commented Dec 22, 2024 via email

@viresh-ratnakar
Copy link
Owner

Thanks!

Yes, I think setters would not want to reveal the full "quantum" nature with just a single cell-reveal. Note that the alternative picked for revealing a cell would be the one consistent with any currently forced alternatives group (from another cell in the group having been filled already).

@criptik
Copy link

criptik commented Dec 22, 2024 via email

@viresh-ratnakar
Copy link
Owner

Will close this bug tomorrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants