mirror of
https://github.com/pupperpowell/bibdle.git
synced 2026-02-04 10:54:44 -05:00
fixed "1 guess" on results
This commit is contained in:
@@ -49,17 +49,14 @@
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
}),
|
||||
})
|
||||
);
|
||||
|
||||
let isWon = $derived(guesses.some((g) => g.book.id === correctBookId));
|
||||
let grade = $derived(
|
||||
isWon
|
||||
? getGrade(
|
||||
guesses.length,
|
||||
getBookById(correctBookId)?.popularity ?? 0,
|
||||
)
|
||||
: "",
|
||||
? getGrade(guesses.length, getBookById(correctBookId)?.popularity ?? 0)
|
||||
: ""
|
||||
);
|
||||
|
||||
function getBookById(id: string): BibleBook | undefined {
|
||||
@@ -86,7 +83,7 @@
|
||||
const adjacent = isAdjacent(book.id, correctBookId);
|
||||
|
||||
console.log(
|
||||
`Guess: ${book.name} (order ${book.order}), Correct: ${correctBook.name} (order ${correctBook.order}), Adjacent: ${adjacent}`,
|
||||
`Guess: ${book.name} (order ${book.order}), Correct: ${correctBook.name} (order ${correctBook.order}), Adjacent: ${adjacent}`
|
||||
);
|
||||
|
||||
guesses = [
|
||||
@@ -110,8 +107,7 @@
|
||||
|
||||
// Fallback UUID v4 generator for older browsers
|
||||
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
||||
const r =
|
||||
window.crypto.getRandomValues(new Uint8Array(1))[0] % 16 | 0;
|
||||
const r = window.crypto.getRandomValues(new Uint8Array(1))[0] % 16 | 0;
|
||||
const v = c === "x" ? r : (r & 0x3) | 0x8;
|
||||
return v.toString(16);
|
||||
});
|
||||
@@ -170,7 +166,7 @@
|
||||
if (!browser) return;
|
||||
localStorage.setItem(
|
||||
`bibdle-guesses-${dailyVerse.date}`,
|
||||
JSON.stringify(guesses.map((g) => g.book.id)),
|
||||
JSON.stringify(guesses.map((g) => g.book.id))
|
||||
);
|
||||
});
|
||||
|
||||
@@ -195,7 +191,7 @@
|
||||
(async () => {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`/api/submit-completion?anonymousId=${anonymousId}&date=${dailyVerse.date}`,
|
||||
`/api/submit-completion?anonymousId=${anonymousId}&date=${dailyVerse.date}`
|
||||
);
|
||||
const result = await response.json();
|
||||
console.log("Stats response:", result);
|
||||
@@ -205,7 +201,7 @@
|
||||
statsData = result.stats;
|
||||
localStorage.setItem(
|
||||
`bibdle-stats-submitted-${dailyVerse.date}`,
|
||||
"true",
|
||||
"true"
|
||||
);
|
||||
} else if (result.error) {
|
||||
console.error("Server error:", result.error);
|
||||
@@ -249,7 +245,7 @@
|
||||
statsSubmitted = true;
|
||||
localStorage.setItem(
|
||||
`bibdle-stats-submitted-${dailyVerse.date}`,
|
||||
"true",
|
||||
"true"
|
||||
);
|
||||
} else if (result.error) {
|
||||
console.error("Server error:", result.error);
|
||||
@@ -283,13 +279,13 @@
|
||||
year: "numeric",
|
||||
});
|
||||
const formattedDate = dateFormatter.format(
|
||||
new Date(`${dailyVerse.date}T00:00:00`),
|
||||
new Date(`${dailyVerse.date}T00:00:00`)
|
||||
);
|
||||
const siteUrl = window.location.origin;
|
||||
return [
|
||||
`📖 Bibdle | ${formattedDate} 📖`,
|
||||
`${grade} (${guesses.length} guesses)`,
|
||||
`${emojis}\n`,
|
||||
`${grade} (${guesses.length} ${guesses.length == 1 ? "guess" : "guesses"})`,
|
||||
`${emojis}`,
|
||||
siteUrl,
|
||||
].join("\n");
|
||||
}
|
||||
|
||||
14
todo.md
14
todo.md
@@ -66,3 +66,17 @@ I created Bibdle from a combination of two things. The first is my lifelong desi
|
||||
- deploy
|
||||
|
||||
---
|
||||
|
||||
# Goals for Bibdle
|
||||
|
||||
My inspiration for this game is very much centered in the Wordle story, where product design legend Josh Wardle created a fun word puzzle for him and his girlfriend. It was so fun that it spread around his immediate family like wildfire, getting to a point of around 90 consistent daily players for a long time before exploding. And of similar stories like Balatro, Bear Blog, and more.
|
||||
|
||||
The initial response to Bibdle has been strong. People like it AND quite a few actually come back to continue doing it.
|
||||
|
||||
But the question that has been getting to me: Is it fun enough? Is it novel enough? Is it challenging enough? Is it easy enough?
|
||||
|
||||
Is it enough?
|
||||
|
||||
How can I make it even better?
|
||||
|
||||
Reading: Designing Games by Tynan Sylvester
|
||||
|
||||
Reference in New Issue
Block a user