App-Greple-wordle

 view release on metacpan or  search on metacpan

CLAUDE.md  view on Meta::CPAN

2. Builds lookahead assertions for required chars
3. Creates negative lookahead for excluded chars
4. Combines into single regex pattern for word filtering

## Technical Requirements

- **Perl version**: v5.18.2 minimum (declared in cpanfile)
- **Build system**: Module::Build::Tiny (via minil)
- **Key dependencies**:
  - App::Greple 8.58+
  - Getopt::EX 2.1.6+
  - Getopt::EX::Hashed 1.05+
  - Mo (minimal object system)
  - Data::Section::Simple (for dataset storage)
  - Date::Calc, Text::VisualWidth::PP

## Testing Notes

- CI tests against Perl 5.18, 5.28, 5.30, 5.36, 5.38, 5.40
- Test file naming: `NN_description.t` pattern in `t/` directory
- Currently only has compilation test (`00_compile.t`)
- Use `use lib 'lib';` in new tests to access in-tree modules

## Updating NYT Wordle Data

### Data Sources

1. **NYT Official Answers** (chronological list): https://wordfinder.yourdictionary.com/wordle/answers/
   - Contains all official Wordle answers from June 19, 2021 (CIGAR) to present
   - Updated daily with the latest answer

2. **Valid Word List**: https://github.com/alex1770/wordle
   - `wordlist_all` - Complete set of allowable guesses (~14,855 words)
   - `wordlist_hidden` - Extended answer list (~3,158 words)

### Extracting Latest NYT Answers

```bash
# Download the WordFinder page
curl -s "https://wordfinder.yourdictionary.com/wordle/answers/" > /tmp/wordle_page.html

# Extract all answers using Perl
cat > /tmp/extract_answers.pl << 'EOF'
#!/usr/bin/env perl
use strict;
use warnings;

my $html = do { local $/; <STDIN> };

# Extract todayData answer
if ($html =~ /todayData:\{[^}]*answer:"([A-Z]+)\s*"/) {
    print lc($1), "\n";
}

# Extract all pastData answers
while ($html =~ /answer:"([A-Z]+)\s*"/g) {
    print lc($1), "\n";
}
EOF

chmod +x /tmp/extract_answers.pl
cat /tmp/wordle_page.html | perl /tmp/extract_answers.pl > /tmp/all_answers.txt

# Remove duplicates while preserving order (newest first)
cat /tmp/all_answers.txt | awk '!seen[$0]++' > /tmp/nyt_answers_unique.txt

# Reverse to get chronological order (oldest first: cigar → latest)
tail -r /tmp/nyt_answers_unique.txt > /tmp/nyt_answers_final.txt

# Verify: should start with "cigar" and end with today's answer
head -1 /tmp/nyt_answers_final.txt  # Should be "cigar"
tail -1 /tmp/nyt_answers_final.txt  # Should be today's answer
wc -l /tmp/nyt_answers_final.txt    # Should match current puzzle number
```

### Downloading Valid Word List

```bash
# Download the complete valid word list from alex1770/wordle
curl -s https://raw.githubusercontent.com/alex1770/wordle/main/wordlist_all > /tmp/wordlist_all.txt

# Verify
wc -l /tmp/wordlist_all.txt  # Should be ~14,855 words
```

### Updating Word List Files

The repository contains two sets of word lists:

- **word_nyt_hidden.pm**: NYT official answers (chronological, cigar → present)
- **word_nyt_all.pm**: All valid guessable words

Update these files with the extracted data:

```bash
# Update word_nyt_hidden.pm
cat > lib/App/Greple/wordle/word_nyt_hidden.pm << 'EOF'
package App::Greple::wordle::word_nyt_hidden;

use v5.14;
use warnings;

use Exporter 'import';
our @EXPORT_OK = qw(@word_nyt_hidden);

our   @word_nyt_hidden = <DATA>;
chomp @word_nyt_hidden;

1;

__DATA__
EOF
cat /tmp/nyt_answers_final.txt >> lib/App/Greple/wordle/word_nyt_hidden.pm

# Update word_nyt_all.pm
cat > lib/App/Greple/wordle/word_nyt_all.pm << 'EOF'
package App::Greple::wordle::word_nyt_all;

use v5.14;
use warnings;



( run in 1.169 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )