GithubHelp home page GithubHelp logo

crossword's People

Contributors

philhanna avatar

Stargazers

 avatar

Watchers

 avatar  avatar

crossword's Issues

Export puzzle for submission

Once a puzzle is complete, need a way to export it to PDF in various formats. To begin with, I'm only using the NYTimes format. See Times submissions for details.
I have working code in nytimes_output.py, but it requires a file name for the output and a puzzle object. The GUI needs to supply these two things.

Right now, I have it as a top-level menu option, but maybe it should be part of the puzzle menu?

Entering too short a word causes array index error

Steps to reproduce:

  1. Open a puzzle
  2. Click on a word start
  3. In the edit word dialog, shorten the displayed word to just one character
  4. Click OK
    Error occurs:
    File "crossword/webapp.py", line 256, in edit_word_screen
    word.set_text(text)
    File "crossword/word.py", line 46, in set_text
    letter = text[i]
    IndexError: string index out of range

Support new black cells in existing puzzle

At present, you have to be completely done with designing a grid (the black cells) before you can create a puzzle from it. This makes it inconvenient if you have been working on a puzzle for a while and then realize that you need to change the grid structure. You don't want to lose all the work you've done.

Proposed change

  • Add a menu option under Puzzle to extract and save this puzzle's grid
  • Add a menu option under Puzzle to use a different grid
  • Can only be done if the grids are the same size
  • The new grid is merged into the existing puzzle:
    • The puzzle's current black cells are set to blanks
    • The new grid's black cells are copied to the puzzle

Improve the publish workflow and format

This consists of several tasks:

  • Change the nytimes_output.py to use DOM rather than generating HTML manually
  • Do not automatically write the HTML and SVG output to files - return as strings
  • In webapp.publish_nytimes_screen(), create a .zip file with these two files
  • Return download link

Show statistics about grid

Menu option to see:

  • Validity
  • Word count
  • Words by length

Currently this information is only seen when the grid is saved.

Grid screen doesn't always calculate numbered cells

Sometimes when editing a grid, the cells that should be numbered don't always get new numbers.
I have noticed this when I click a cell and then click it again to clear it.
I have also noticed that when I click outside the grid it seems to cause the renumbering.

Export/Import to spreadsheet from menu

Need to be able to export a puzzle to .csv and import from .csv. This will allow someone to work on the clues outside of the application. The system already has the capability to do this (see clue_export_visitor), it just needs to be integrated with the menu.

The raw .csv file can be edited directly with Microsoft Excel, or uploaded to Google Drive so that it can be shared with whoever needs to update it.

Exported puzzle in Google Sheets

Add validation to grid save

Currently, the user can click on any set of cells in the grid to make them black cells.
However, not all these configurations are valid. For example, the New York Times
requires that:

  • Crosswords must have black square symmetry, which typically comes in the form of 180-degree rotational symmetry;
  • Crosswords must have all-over interlock;
  • Crosswords must not have unchecked squares
 (i.e., all letters must be found in both Across and Down answers);
  • All answers must be at least 3 letters long;
  • Black squares should be used in moderation.
    (Source: NYTimes submissions guidelines)

When the user chooses "Save grid" or "Save grid as...", the system should ensure that these guidelines are met. If not, the save should be prevented and message should be flashed.

Undo/redo at the word level

From the beginning of the editing session for a puzzle, keep track of each time the Edit Word OK button has been clicked, and implement undo/redo for the word value.

Separate validation messages with individual headings

Currently, the validation messages are all run together, separated by titles that start and end with "***".
Need to return the three validation sets individually, so that they can be displayed better in the UI.

Make messages screen non-modal

It's clumsy to have to dismiss a message dialog. Better to have a place in the main screen where messages can be displayed. There is frequently only one message; perhaps a w3-panel at the bottom of the screen? Still with a close X.

Use DOM to build HTML, not string concatenation

grid-chooser-ajax.js currently builds anchor tags within list items manually with
string concatenation. This is fragile and error-prone. Better to build DOM child elements
with the DOM API, as in do-suggest-word.js.

    links = "";
    for (i = 0; i < grid_list.length; i++) {
        filename = grid_list[i]
        href = build_url(filename)
        quoted_href = "'" + href + "'"
        anchor = "<a href=" + quoted_href + ">" + filename + "</a>"
        listitem = "<li>" + anchor + "</li>"
        links += listitem + "\n"
    }
    document.getElementById("grid-list").innerHTML = links

Grid clicks do not work properly on Firefox

In Firefox, if I click on a grid, the parent x and y coordinates of the containing element are different than they are in Chrome. This means that I am not calculating the row and column of the click properly. This affects grid.js and puzzle.js.

Steps to reproduce

  1. Bring up sample grid-1 in Firefox
  2. Click 22 across to create a black cell
  3. Click 22 across to remove this black cell

The 22 across black cell remains, and (1,1) is now black

Progress so far

There are two Javascript functions that use the click event:

  • grid_click(event), which is triggered when the user clicks on a cell in the grid screen
  • getRC(event), which is triggered when the user clicks on a cell in the puzzle screen

Both of them use code like this:

 var x = event.offsetX;
 var y = event.offsetY;

Apparently the Firefox event model is different. I fiddled with it for several hours and couldn't make any headway.

Print the puzzle without words

Be able to print the puzzle in final published form, without the answers, so that I can just hand it to someone to solve.

Add puzzle or grid name to "are you sure" delete dialog

ME: Delete myfile
COMPUTER: Are you sure (Y/N)?
ME: Yes
COMPUTER: Are you really sure (Y/N)?
ME: Yes
COMPUTER: Are you really really sure (Y/N)?
ME: Yes
COMPUTER: (deletes myfile)
ME: Whoops, damn!

The problem is that I meant to delete myotherfile.

"Are you sure" messages shouldn't just ask you to confirm the action you want to perform, but the thing you want to perform the action on. The message should include the name of the thing:

COMPUTER: Are you sure you want to delete "myfile" (Y/N)?
ME: No
ME: Phew!

Clear the "suggest" dropdown

If a "suggest word" dropdown has been populated, it needs to be cleared before the edit word dialog is displayed.

In edit word, undo regular expressions

User can enter a regular expression in the word, like [AEIOU] for a vowel, or [^AEIOU] for a consonant. This is extremely useful. But if user clicks OK while the regex is still in the input box, it overlays the text of the word.

I think it's good enough to just check for illegal characters in Javascript and open an alert if there are any.

Refactor javascript

I have been careless about not using var when declaring variables in javascript.

Generate PDF directly

Right now, I generate HTML that links to an SVG image. I have to post-process it by opening it in Microsoft Word, fiddling around with the positioning, then saving as PDF.

It would be much more straightforward to generate the PDF directly.

This would change:

  • Publish in New York Times format

Suggest word

In the edit word dialog, there is a suggest button. Need to hook this up with a search of the word list for matches for the word, including its actual letters and the dots that represent missing letters.

Refactor DOM element ids

Need a shorter name for ids. Maybe two-letter abbreviation for the dialog itself, then one letter suffix for individual elements.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.