func DayOf
DayOf returns the UTC day number for a unix timestamp.
Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.
Package puzzlerounds is the reusable, stateless puzzle-round library behind Riddle Tavern (gno.land/r/g1j7l6ekxy82r9t...
Package puzzlerounds is the reusable, stateless puzzle-round library behind Riddle Tavern (gno.land/r/g1j7l6ekxy82r9tav7d8jv3gp0h3xaunw2m2k3lx/riddletavern).
It holds the commitment scheme, the round record, streak math and leaderboard ordering, so any other realm or package can import it and run the same twice-daily puzzle game without copying the logic.
Answer commitment scheme (public, part of the game rules):
DayOf returns the UTC day number for a unix timestamp.
NextStreak computes the new streak after a solve on day today, given the day of the previous solve (lastDay, 0 if never) and the current streak. Ported from Puzzle Arena (BSC):
SortLeaders sorts in place: most solves first, then highest streak, then lowest address (deterministic tie-break).
VerifyAnswer reports whether answer matches the stored commitment.
HashAnswer computes the commitment for an answer.
The answer is encoded as its decimal string and hashed with sha256. The encoding is part of the public commitment scheme: anyone can recompute it to verify a round, and the answer itself is never stored.
AnswerHash is a sha256 commitment to a puzzle answer.
Leader is one row of the leaderboard.
Round is the public record of one puzzle round. It carries no behaviour of its own; the realm that owns the round holds the state.