|
|
|
@ -3,17 +3,17 @@
|
|
|
|
|
<head>
|
|
|
|
|
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
|
|
|
|
|
<meta content="utf-8" http-equiv="encoding">
|
|
|
|
|
<title>Anagram Mastermind</title>
|
|
|
|
|
<title>Anagram Bagels</title>
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="main.css" />
|
|
|
|
|
<script src="../random.js"></script>
|
|
|
|
|
<script src="../scramblestring.js"></script>
|
|
|
|
|
<script type="text/javascript" src="../wordlist/typo.js"></script>
|
|
|
|
|
<script src="../wordlist/wordlist.js"></script>
|
|
|
|
|
<script src="./mastermind.js"></script>
|
|
|
|
|
<script src="./bagels.js"></script>
|
|
|
|
|
<script src="../entryui.js"></script>
|
|
|
|
|
<script >
|
|
|
|
|
class MastermindUI extends AnagramEntryUI {
|
|
|
|
|
class BagelsUI extends AnagramEntryUI {
|
|
|
|
|
recolorAvailableLetters() {
|
|
|
|
|
let idx = this.focusedTextbox;
|
|
|
|
|
document.querySelectorAll('#available_letters button').forEach(b => {
|
|
|
|
@ -118,7 +118,7 @@
|
|
|
|
|
|
|
|
|
|
let game;
|
|
|
|
|
do {
|
|
|
|
|
game = Mastermind.generateRandom(settings);
|
|
|
|
|
game = Bagels.generateRandom(settings);
|
|
|
|
|
} while (game === null && window.confirm('Unable to generate puzzle with the given difficulty settings. Try again?'));
|
|
|
|
|
if (game !== null) this.initialize(game);
|
|
|
|
|
}
|
|
|
|
@ -134,7 +134,7 @@
|
|
|
|
|
return default_settings;
|
|
|
|
|
}
|
|
|
|
|
get settingsKey() {
|
|
|
|
|
return 'anagram-mastermind-settings';
|
|
|
|
|
return 'anagram-bagels-settings';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
constructor(game) {
|
|
|
|
@ -209,10 +209,10 @@
|
|
|
|
|
let fragment = window.location.hash.substring(1);
|
|
|
|
|
return unscrambleString(fragment).then(unscrambled => {
|
|
|
|
|
history.pushState("", document.title, window.location.pathname + window.location.search);
|
|
|
|
|
return Mastermind.fromFragment(unscrambled);
|
|
|
|
|
return Bagels.fromFragment(unscrambled);
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
.then(game => new MastermindUI(game)));
|
|
|
|
|
.then(game => new BagelsUI(game)));
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<template id="letter_entry">
|
|
|
|
@ -259,9 +259,11 @@
|
|
|
|
|
<h1>How to Play</h1>
|
|
|
|
|
<h2>Gameplay</h2>
|
|
|
|
|
<p>
|
|
|
|
|
Anagram Mastermind is a variant of the classic game
|
|
|
|
|
Anagram Bagels is a variant of the classic game Bagels (also
|
|
|
|
|
known as <a href="https://en.wikipedia.org/wiki/Bulls_and_Cows"
|
|
|
|
|
>Bulls and Cows</a> or
|
|
|
|
|
<a href="https://en.wikipedia.org/wiki/Mastermind_(board_game)"
|
|
|
|
|
>Mastermind</a> where the secret clue and guesses must all be
|
|
|
|
|
>Mastermind</a>) where the secret clue and guesses must all be
|
|
|
|
|
English words. The computer randomly selects a word and a set
|
|
|
|
|
of letters that may be used in guesses and tells you how many
|
|
|
|
|
letters are in the word. In response to each guess, the computer
|