Skip to content

Commit

Permalink
v0.80
Browse files Browse the repository at this point in the history
### Version: Exet v0.80 March 16, 2023

- Bug fix: letterHist() function was not counting As at all after the last
  version!
- Start noting maxCharCodes in the lexicon.
  • Loading branch information
viresh-ratnakar authored Mar 17, 2023
1 parent fe91f74 commit bd718f4
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 17 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

### Version: Exet v0.80 March 16, 2023

- Bug fix: letterHist() function was not counting As at all after the last
version!
- Start noting maxCharCodes in the lexicon.

### Version: Exet v0.79 March 13, 2023

- Refactor, moving css/js into separate files, leaving a slim exet.html.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## A web app for crossword construction

#### Version: Exet v0.79 March 13, 2023
#### Version: Exet v0.80 March 16, 2023

#### Author: Viresh Ratnakar

Expand Down
2 changes: 1 addition & 1 deletion about-exet.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<center>
<h1>Exet</h1>
<h3>A web app for crossword construction</h3>
<h4>Version: Exet v0.79 March 13, 2023</h4>
<h4>Version: Exet v0.80 March 16, 2023</h4>
<h4>Software by Viresh Ratnakar</h4>
<h3 title="Click to open Exet's README.md file in a new tab">
<a target="_blank"
Expand Down
12 changes: 8 additions & 4 deletions exet-lexicon.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Copyright (c) 2022 Viresh Ratnakar
See the full Exet license notice in exet.html.
Current version: v0.79 Match 13, 2023
Current version: v0.80 Match 16, 2023
*/

/**
Expand All @@ -27,13 +27,18 @@ function exetLexiconInit() {
exetLexicon.allLetters = {};
exetLexicon.letterFreq = {};
exetLexicon.letterIndex = {};
exetLexicon.maxCharCodes = 1;
exetLexicon.zeroHist = new Array(exetLexicon.letters.length);
for (let i = 0; i < exetLexicon.letters.length; i++) {
const c = exetLexicon.letters[i];
console.assert(c.toUpperCase() == c, c);
if (c.length > exetLexicon.maxCharCodes) {
exetLexicon.maxCharCodes = c.length;
}
exetLexicon.letterIndex[c] = i;
exetLexicon.zeroHist[i] = 0;
}
console.assert(exetLexicon.maxCharCodes == 1, exetLexicon.maxCharCodes);
for (let c of exetLexicon.letters) {
const cu = c.toUpperCase();
exetLexicon.allLetters[cu] = true;
Expand Down Expand Up @@ -354,9 +359,8 @@ function exetLexiconInit() {
const phraseU = phrase.toUpperCase();
const hist = this.zeroHist.slice();
for (let l of phraseU) {
const idx = this.letterIndex[l];
if (!idx) continue;
hist[idx]++;
if (!this.allLetters[l]) continue;
hist[this.letterIndex[l]]++;
}
return hist;
}
Expand Down
2 changes: 1 addition & 1 deletion exet-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.79
v0.80
2 changes: 1 addition & 1 deletion exet.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* See the full license notice in exet.js.
*
* Current version: v0.79 March 13, 2023
* Current version: v0.80 March 16, 2023
*/

[contenteditable="true"]:active,
Expand Down
2 changes: 1 addition & 1 deletion exet.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
See the full license notice in exet.js.
Current version: v0.79 March 13, 2023
Current version: v0.80 March 16, 2023
-->

<link rel="stylesheet" type="text/css" href="exolve-m.css"/>
Expand Down
37 changes: 29 additions & 8 deletions exet.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ SOFTWARE.
The latest code and documentation for Exet can be found at:
https://github.com/viresh-ratnakar/exet
Current version: v0.79 March 13, 2023
Current version: v0.80 March 16, 2023
*/

function ExetModals() {
Expand Down Expand Up @@ -802,6 +802,20 @@ Exet.prototype.setPuzzle = function(puz) {
alert('Non-numeric clues not yet supported')
return;
}
if ((puz.language && puz.language != exetLexicon.language) ||
(!puz.language && 'en' != exetLexicon.language) ||
(puz.languageScript && puz.languageScript != exetLexicon.script) ||
(!puz.languageScript && 'Latin' != exetLexicon.script)) {
alert('The lexicon is in ' +
exetLexicon.language + ' (' + exetLexicon.script + ') but the ' +
'puzzle has ' + puz.language + ' (' + puz.languageScript + ')');
return;
}
if (puz.langMaxCharCodes != exetLexicon.maxCharCodes) {
alert('Lexicon has MaxCharCodes = ' + exetLexicon.maxCharCodes +
' but the puzzle has ' + puz.langMaxCharCodes);
return;
}
if (puz.columnarLayout) {
puz.columnarLayout = false;
puz.gridcluesContainer.className = 'xlv-grid-and-clues-flex'
Expand Down Expand Up @@ -853,7 +867,7 @@ Exet.prototype.setPuzzle = function(puz) {
'setter', 'copyright', 'nina', 'colour', 'color',
'question', 'across', 'down', '3d', '3d-across',
'3d-away', '3d-down', 'prelude', 'preamble',
'explanations', 'maker', 'reversals'];
'explanations', 'maker', 'reversals', 'language'];
const rangesToSkip = [];
for (let sec of sectionsToSkip) {
if (this.puz.sectionLines[sec]) {
Expand Down Expand Up @@ -7235,11 +7249,12 @@ Exet.prototype.updatePuzzle = function(revType=0) {

Exet.prototype.getGrid = function(solved=true) {
if (!this.puz) {
return ''
return '';
}
let grid = ''
const ENTRY_WIDTH = 3 + this.puz.langMaxCharCodes;
let grid = '';
for (let i = 0; i < this.puz.gridHeight; i++) {
let gridRow = ' '
let gridRow = ' ';
for (let j = 0; j < this.puz.gridWidth; j++) {
let gridCell = this.puz.grid[i][j]
let entry = '.';
Expand All @@ -7252,12 +7267,12 @@ Exet.prototype.getGrid = function(solved=true) {
'+' : (gridCell.hasBarAfter ?
'|' : (gridCell.hasBarUnder ? '_' : '')));
}
while (entry.length < 4) entry += ' ';
while (entry.length < ENTRY_WIDTH) entry += ' ';
gridRow += entry;
}
grid = grid + '\n' + gridRow
grid = grid + '\n' + gridRow;
}
return grid
return grid;
}

Exet.prototype.showClue = function(clue, forExolve=true,
Expand Down Expand Up @@ -7388,6 +7403,11 @@ Exet.prototype.getExolve = function(id='', skipClues=false, solved=true,
exolve-copyright: ${this.puz.copyright}` : '') + `
exolve-maker: ${maker}`

if (this.puz.language || this.puz.languageScript ||
this.puz.langMaxCharCodes > 1) {
exolve += `
exolve-language: ${exetLexicon.language} ${exetLexicon.script} ${exetLexicon.maxCharCodes}`
}
if (showColoursNinas) {
exolve += this.getExolveColours();
if (solved) {
Expand Down Expand Up @@ -8570,6 +8590,7 @@ function exetBlank(w=15, h=15, layers3d=1, id='', automagic=false,
exolve-id: ${id}
exolve-title: Crossword
exolve-setter: Exetter
exolve-language: ${exetLexicon.language} ${exetLexicon.script} ${exetLexicon.maxCharCodes}
exolve-width: ${w}
exolve-height: ${h}
exolve-grid: ${grid}
Expand Down

0 comments on commit bd718f4

Please sign in to comment.