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",
|
year: "numeric",
|
||||||
month: "long",
|
month: "long",
|
||||||
day: "numeric",
|
day: "numeric",
|
||||||
}),
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
let isWon = $derived(guesses.some((g) => g.book.id === correctBookId));
|
let isWon = $derived(guesses.some((g) => g.book.id === correctBookId));
|
||||||
let grade = $derived(
|
let grade = $derived(
|
||||||
isWon
|
isWon
|
||||||
? getGrade(
|
? getGrade(guesses.length, getBookById(correctBookId)?.popularity ?? 0)
|
||||||
guesses.length,
|
: ""
|
||||||
getBookById(correctBookId)?.popularity ?? 0,
|
|
||||||
)
|
|
||||||
: "",
|
|
||||||
);
|
);
|
||||||
|
|
||||||
function getBookById(id: string): BibleBook | undefined {
|
function getBookById(id: string): BibleBook | undefined {
|
||||||
@@ -86,7 +83,7 @@
|
|||||||
const adjacent = isAdjacent(book.id, correctBookId);
|
const adjacent = isAdjacent(book.id, correctBookId);
|
||||||
|
|
||||||
console.log(
|
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 = [
|
guesses = [
|
||||||
@@ -110,8 +107,7 @@
|
|||||||
|
|
||||||
// Fallback UUID v4 generator for older browsers
|
// Fallback UUID v4 generator for older browsers
|
||||||
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
||||||
const r =
|
const r = window.crypto.getRandomValues(new Uint8Array(1))[0] % 16 | 0;
|
||||||
window.crypto.getRandomValues(new Uint8Array(1))[0] % 16 | 0;
|
|
||||||
const v = c === "x" ? r : (r & 0x3) | 0x8;
|
const v = c === "x" ? r : (r & 0x3) | 0x8;
|
||||||
return v.toString(16);
|
return v.toString(16);
|
||||||
});
|
});
|
||||||
@@ -170,7 +166,7 @@
|
|||||||
if (!browser) return;
|
if (!browser) return;
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
`bibdle-guesses-${dailyVerse.date}`,
|
`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 () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
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();
|
const result = await response.json();
|
||||||
console.log("Stats response:", result);
|
console.log("Stats response:", result);
|
||||||
@@ -205,7 +201,7 @@
|
|||||||
statsData = result.stats;
|
statsData = result.stats;
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
`bibdle-stats-submitted-${dailyVerse.date}`,
|
`bibdle-stats-submitted-${dailyVerse.date}`,
|
||||||
"true",
|
"true"
|
||||||
);
|
);
|
||||||
} else if (result.error) {
|
} else if (result.error) {
|
||||||
console.error("Server error:", result.error);
|
console.error("Server error:", result.error);
|
||||||
@@ -249,7 +245,7 @@
|
|||||||
statsSubmitted = true;
|
statsSubmitted = true;
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
`bibdle-stats-submitted-${dailyVerse.date}`,
|
`bibdle-stats-submitted-${dailyVerse.date}`,
|
||||||
"true",
|
"true"
|
||||||
);
|
);
|
||||||
} else if (result.error) {
|
} else if (result.error) {
|
||||||
console.error("Server error:", result.error);
|
console.error("Server error:", result.error);
|
||||||
@@ -283,13 +279,13 @@
|
|||||||
year: "numeric",
|
year: "numeric",
|
||||||
});
|
});
|
||||||
const formattedDate = dateFormatter.format(
|
const formattedDate = dateFormatter.format(
|
||||||
new Date(`${dailyVerse.date}T00:00:00`),
|
new Date(`${dailyVerse.date}T00:00:00`)
|
||||||
);
|
);
|
||||||
const siteUrl = window.location.origin;
|
const siteUrl = window.location.origin;
|
||||||
return [
|
return [
|
||||||
`📖 Bibdle | ${formattedDate} 📖`,
|
`📖 Bibdle | ${formattedDate} 📖`,
|
||||||
`${grade} (${guesses.length} guesses)`,
|
`${grade} (${guesses.length} ${guesses.length == 1 ? "guess" : "guesses"})`,
|
||||||
`${emojis}\n`,
|
`${emojis}`,
|
||||||
siteUrl,
|
siteUrl,
|
||||||
].join("\n");
|
].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
|
- 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