diff --git a/web-optimle/www/src/Game.tsx b/web-optimle/www/src/Game.tsx
index 60ac1c4..34f6aca 100644
--- a/web-optimle/www/src/Game.tsx
+++ b/web-optimle/www/src/Game.tsx
@@ -9,7 +9,7 @@ import { COMMON_WORDS, UNCOMMON_WORDS } from './dictionary';
import { Row, RowState } from './Row';
import { Keyboard } from './Keyboard';
import { useLocalStorage } from './localstorage';
-import { PuzzleType, PuzzleTypeDisplay } from './PuzzleType';
+import { PuzzleType, PuzzleTypeDisplay, PUZZLE_TYPES } from './PuzzleType';
const MAX_GUESSES = 2;
const WORD_LENGTH = 5;
@@ -53,6 +53,10 @@ type DailyStats = {
[key in PuzzleType]: PuzzleStats
};
+function tries(t: number) {
+ return t === 1 ? "my first try" : `try #${t}`;
+}
+
export function Game(props: GameProps) {
const { puzzleType, puzzle, day } = props;
@@ -97,6 +101,7 @@ export function Game(props: GameProps) {
);
if (selectedPuzzle.won) {
setGameState(GameState.Won);
+
if (selectedPuzzle.tries === 1) {
setHint(<>
You won today's {' '}
@@ -112,20 +117,31 @@ export function Game(props: GameProps) {
const emoji = props.colorBlind
? ["⬛", "🟦", "🟧"]
: ["⬛", "🟨", "🟩"];
- const score = (todayStats[puzzleType].tries === 1
- ? "my first try!"
- : `try #${todayStats[puzzleType].tries}!`
- );
- setShareMsg(
- `I solved ${gameName} #${puzzle.seed} (${puzzleType}🟩) on ${score}\n` +
- (selectedPuzzle.guesses || [])
- .map((result) =>
- clue(result)
- .map((c) => emoji[c.clue ?? 0])
- .join("")
- )
- .join("\n")
- );
+ if (PUZZLE_TYPES.every((type) => todayStats[type]?.won)) {
+ setShareMsg(
+ `I solved all 3 puzzles in ${gameName} #${puzzle.seed}!\n` +
+ PUZZLE_TYPES.slice().reverse().map((type) =>
+ (todayStats[type].guesses || [])
+ .map((result) =>
+ clue(result)
+ .map((c) => emoji[c.clue ?? 0])
+ .join("")
+ )
+ .join("\n") + ` (${type}🟩, ${tries(todayStats[type].tries)})`
+ ).join("\n")
+ );
+ } else {
+ setShareMsg(
+ `I solved ${gameName} #${puzzle.seed} (${puzzleType}🟩) on ${tries(selectedPuzzle.tries)}!\n` +
+ (selectedPuzzle.guesses || [])
+ .map((result) =>
+ clue(result)
+ .map((c) => emoji[c.clue ?? 0])
+ .join("")
+ )
+ .join("\n")
+ );
+ }
} else if ((selectedPuzzle.guesses?.length || 0) >= 2) {
setGameState(GameState.Lost);
setHint(
Not quite! The answer could've been {game.possible_word().toUpperCase()}. (Enter to try again)
);
@@ -335,7 +351,7 @@ export function Game(props: GameProps) {