Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion CLIGames-web/categories.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<header>
<h1 class="heading"><em>Categories</em> | CLI Word Games</h1>
<h5 class="heading">No ads. No upsell. Open source and in sync.</h5>
<h2 class="heading"><a href="words.html">Words</a> | <a href="categories.html">Categories</a> | <a href="index.html">Home</a></h2>
<h2 class="heading"><a href="words.html">Words</a> | <a href="categories.html">Categories</a> | <a href="spelling-bee.html">Spelling Bee</a> | <a href="mini.html">Mini</a> | <a href="midi.html">MIDI</a> | <a href="pips.html">Pips</a> | <a href="index.html">Home</a></h2>
</header>
<div id="game">
Error loading game. Please try again later.
Expand Down
4 changes: 4 additions & 0 deletions CLIGames-web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ <h5 class="heading">No ads. No upsell. Open source and in sync.</h5>
<h2>
<a href="words.html">Words</a> |
<a href="categories.html">Categories</a> |
<a href="spelling-bee.html">Spelling Bee</a> |
<a href="mini.html">Mini</a> |
<a href="midi.html">MIDI</a> |
<a href="pips.html">Pips</a> |
<a href="index.html">Home</a>
</h2>
</nav>
Expand Down
30 changes: 30 additions & 0 deletions CLIGames-web/midi.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MIDI | CLI Word Games</title>
<link rel="stylesheet" href="src/css/styles.css">
</head>
<body>
<br>
<div class="container">
<header>
<h1 class="heading"><em>MIDI Crossword</em> | CLI Word Games</h1>
<h5 class="heading">No ads. No upsell. Open source and in sync.</h5>
<h2 class="heading"><a href="words.html">Words</a> | <a href="categories.html">Categories</a> | <a href="spelling-bee.html">Spelling Bee</a> | <a href="mini.html">Mini</a> | <a href="midi.html">MIDI</a> | <a href="pips.html">Pips</a> | <a href="index.html">Home</a></h2>
</header>
<div id="game">
Error loading game. Please try again later.
</div>
<footer>
<p>Download the CLI for Node.js or fork on <a href="https://github.com/28pins/cliwordgames">GitHub</a></p>
<p>CLI Word Games is licensed under the <a href="https://github.com/28pins/noailicense">NoAILicense</a>.</p>
<p>By <a href="https://github.com/28pins">28pins</a></p>
</footer>
<script src="src/js/nodePorts.js"></script>
<script src="src/js/midi_dailyPuzzles.js"></script>
<script src="src/js/midi.js"></script>
</div>
</body>
</html>
30 changes: 30 additions & 0 deletions CLIGames-web/mini.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mini | CLI Word Games</title>
<link rel="stylesheet" href="src/css/styles.css">
</head>
<body>
<br>
<div class="container">
<header>
<h1 class="heading"><em>Mini Crossword</em> | CLI Word Games</h1>
<h5 class="heading">No ads. No upsell. Open source and in sync.</h5>
<h2 class="heading"><a href="words.html">Words</a> | <a href="categories.html">Categories</a> | <a href="spelling-bee.html">Spelling Bee</a> | <a href="mini.html">Mini</a> | <a href="midi.html">MIDI</a> | <a href="pips.html">Pips</a> | <a href="index.html">Home</a></h2>
</header>
<div id="game">
Error loading game. Please try again later.
</div>
<footer>
<p>Download the CLI for Node.js or fork on <a href="https://github.com/28pins/cliwordgames">GitHub</a></p>
<p>CLI Word Games is licensed under the <a href="https://github.com/28pins/noailicense">NoAILicense</a>.</p>
<p>By <a href="https://github.com/28pins">28pins</a></p>
</footer>
<script src="src/js/nodePorts.js"></script>
<script src="src/js/mini_dailyPuzzles.js"></script>
<script src="src/js/mini.js"></script>
</div>
</body>
</html>
30 changes: 30 additions & 0 deletions CLIGames-web/pips.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pips | CLI Word Games</title>
<link rel="stylesheet" href="src/css/styles.css">
</head>
<body>
<br>
<div class="container">
<header>
<h1 class="heading"><em>Pips</em> | CLI Word Games</h1>
<h5 class="heading">No ads. No upsell. Open source and in sync.</h5>
<h2 class="heading"><a href="words.html">Words</a> | <a href="categories.html">Categories</a> | <a href="spelling-bee.html">Spelling Bee</a> | <a href="mini.html">Mini</a> | <a href="midi.html">MIDI</a> | <a href="pips.html">Pips</a> | <a href="index.html">Home</a></h2>
</header>
<div id="game">
Error loading game. Please try again later.
</div>
<footer>
<p>Download the CLI for Node.js or fork on <a href="https://github.com/28pins/cliwordgames">GitHub</a></p>
<p>CLI Word Games is licensed under the <a href="https://github.com/28pins/noailicense">NoAILicense</a>.</p>
<p>By <a href="https://github.com/28pins">28pins</a></p>
</footer>
<script src="src/js/nodePorts.js"></script>
<script src="src/js/pips_dailyPuzzles.js"></script>
<script src="src/js/pips.js"></script>
</div>
</body>
</html>
30 changes: 30 additions & 0 deletions CLIGames-web/spelling-bee.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Spelling Bee | CLI Word Games</title>
<link rel="stylesheet" href="src/css/styles.css">
</head>
<body>
<br>
<div class="container">
<header>
<h1 class="heading"><em>Spelling Bee</em> | CLI Word Games</h1>
<h5 class="heading">No ads. No upsell. Open source and in sync.</h5>
<h2 class="heading"><a href="words.html">Words</a> | <a href="categories.html">Categories</a> | <a href="spelling-bee.html">Spelling Bee</a> | <a href="mini.html">Mini</a> | <a href="midi.html">MIDI</a> | <a href="pips.html">Pips</a> | <a href="index.html">Home</a></h2>
</header>
<div id="game">
Error loading game. Please try again later.
</div>
<footer>
<p>Download the CLI for Node.js or fork on <a href="https://github.com/28pins/cliwordgames">GitHub</a></p>
<p>CLI Word Games is licensed under the <a href="https://github.com/28pins/noailicense">NoAILicense</a>.</p>
<p>By <a href="https://github.com/28pins">28pins</a></p>
</footer>
<script src="src/js/nodePorts.js"></script>
<script src="src/js/spelling_bee_dailyPuzzles.js"></script>
<script src="src/js/spelling_bee.js"></script>
</div>
</body>
</html>
135 changes: 135 additions & 0 deletions CLIGames-web/src/js/midi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
let answers = {};
let date = new Date();

if (window.location.search) {
const params = new URLSearchParams(window.location.search);
if (params.has('date')) {
const parsed = new Date(params.get('date'));
if (!isNaN(parsed)) date = parsed;
}
}

let puzzle = null;

const HELP_TEXT = `MIDI Crossword
Type "exit" or "quit" to exit the game
Type "help" to see this message again
Type "clues" to see the crossword clues
Type "date" before first guess to enter YYYY-MM-DD
`;

function getPuzzleForDate(d) {
const idx = dailyPuzzles.findIndex(p => {
const pDate = new Date(p.date_string || p.print_date);
return pDate.toDateString() === d.toDateString();
});
return idx >= 0 ? dailyPuzzles[idx] : (dailyPuzzles.length > 0 ? dailyPuzzles[0] : null);
}

async function main() {
consolePort.clear();
puzzle = getPuzzleForDate(date);
if (!puzzle) {
consolePort.log(chalkPort.red('No puzzle found for this date'));
return;
}

consolePort.log(chalkPort.blue(`MIDI Crossword puzzle for ${date.toDateString()}:\n`));
displayPuzzleInfo();

while (true) {
const raw = await inquirerPort.promptForWord('Enter clue number and answer (e.g., "1 HELLO"):');
const input = (raw || '').toLowerCase().trim();

if (!input) {
consolePort.log(chalkPort.red('Empty input\n'));
continue;
}

if (input === 'exit' || input === 'quit') {
consolePort.log('Thanks for playing!\n');
return;
}

if (input === 'help') {
consolePort.log(chalkPort.blue(HELP_TEXT));
continue;
}

if (input === 'clues') {
displayPuzzleInfo();
continue;
}

if (input === 'date' && Object.keys(answers).length === 0) {
const dateInput = prompt('Enter a date (YYYY-MM-DD): ');
const parsed = new Date(dateInput);
if (isNaN(parsed)) {
consolePort.log(chalkPort.red('Invalid date format\n'));
continue;
}
const ymd = formatDateAsYMD(parsed);
window.open(`?date=${ymd}`, '_blank');
consolePort.log(chalkPort.blue(`Opened new tab for ${ymd}\n`));
continue;
}

const parts = input.split(' ');
if (parts.length < 2) {
consolePort.log(chalkPort.red('Please enter a clue number and answer\n'));
continue;
}

const clueNum = parts[0];
const answer = parts.slice(1).join(' ').toUpperCase();

// Find the clue
const clue = puzzle.body && puzzle.body.find(c => c.label === clueNum);
if (!clue) {
consolePort.log(chalkPort.red('Invalid clue number\n'));
continue;
}

// Check if answer is correct
if (clue.answer && clue.answer.toUpperCase() === answer) {
answers[clueNum] = answer;
consolePort.log(chalkPort.green('✓ Correct!\n'));

// Check if puzzle is complete
if (puzzle.body && Object.keys(answers).length === puzzle.body.length) {
consolePort.log(chalkPort.green('🎉 Puzzle complete!\n'));
consolePort.log('Thanks for playing!\n');
return;
}
displayPuzzleInfo();
} else {
consolePort.log(chalkPort.red('✗ Incorrect\n'));
}
}
}

function displayPuzzleInfo() {
if (!puzzle || !puzzle.body) {
consolePort.log(chalkPort.red('Puzzle data unavailable\n'));
return;
}

consolePort.log(chalkPort.blue('Across:\n'));
puzzle.body.filter(c => c.direction === 'Across').forEach(clue => {
const status = answers[clue.label] ? chalkPort.green('✓') : ' ';
consolePort.log(` ${status} ${clue.label}. ${clue.clue}\n`);
});

consolePort.log(chalkPort.blue('\nDown:\n'));
puzzle.body.filter(c => c.direction === 'Down').forEach(clue => {
const status = answers[clue.label] ? chalkPort.green('✓') : ' ';
consolePort.log(` ${status} ${clue.label}. ${clue.clue}\n`);
});

consolePort.log(chalkPort.blue('-'.repeat(50)) + '\n');
consolePort.log(`Filled: ${Object.keys(answers).length}/${puzzle.body.length}\n\n`);
}

main().catch(err => {
consolePort.log(chalkPort.red(`Error: ${err.message}\n`));
});
1 change: 1 addition & 0 deletions CLIGames-web/src/js/midi_dailyPuzzles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const dailyPuzzles = [];
Loading