Move
typeMove is one of rock, paper, or scissors, ordered so that (winner - loser + 3) % 3 == 1 for every winning pair.
Value
v0.Move
Rock
v0.MoveValue
<zero>
Paper
v0.MoveValue
<zero>
Scissors
v0.MoveValue
<zero>
moveName
func(m v0.Move) string- OID
- 0ec89d…7439:3
moveName details
parseMove
func(s string) (v0.Move, bool)- OID
- 0ec89d…7439:5
parseMove details
judge
func(p v0.Move, h v0.Move) intjudge returns 0 for a tie, 1 if p beats h, 2 if h beats p.
- OID
- 0ec89d…7439:6
judge details
revealWindow
int64revealWindow is how many blocks the challenger gets to reveal after the opponent accepts before the opponent can claim a forfeit win.
Value
50
duelStatus
typeValue
v0.duelStatus
statusPending
v0.duelStatusValue
<zero>
statusAwaitingReveal
v0.duelStatusValue
<zero>
statusResolved
v0.duelStatusValue
<zero>
statusForfeited
v0.duelStatusValue
<zero>
statusCancelled
v0.duelStatusValue
<zero>
duel
typeduel is one asynchronous round between Challenger and Opponent. The challenger's move is hidden behind Commit until Reveal; the opponent's move is stored in the clear once they Accept.
Value
v0.duel
playerState
typeplayerState is the persisted record for one address.
Value
v0.playerState
duels
v0.Tree// duel ID -> \*duel
- OID
- 0ec89d…7439:8
duels details
players
v0.Tree// address string -> \*playerState
- OID
- 0ec89d…7439:10
players details
nextID
intValue
0
totalResolved
intValue
0
champion
.uverse.addressValue
<zero>
championWins
intValue
0
ComputeCommit
func(moveStr string, salt string) stringComputeCommit hashes a move and salt exactly the way Reveal checks it, so a caller can compute their commitment (e.g. via a read-only query) before calling Open, then remember the salt to pass to Reveal later.
- OID
- 0ec89d…7439:15
ComputeCommit details
getOrCreate
func(addr .uverse.address) *v0.playerState- OID
- 0ec89d…7439:16
getOrCreate details
bumpChampion
func(addr .uverse.address, wins int)- OID
- 0ec89d…7439:17
bumpChampion details
settle
func(d *v0.duel, challengerMove v0.Move, result int)settle scores a revealed round and updates both players' records.
- OID
- 0ec89d…7439:18
settle details
Open
func(opponentAddr string, commitHex string) stringOpen challenges opponentAddr to a duel, locking in the challenger's move as a commitment (see ComputeCommit) so the opponent can't see it before replying.
- OID
- 0ec89d…7439:19
Open details
Accept
func(id string, moveStr string) stringAccept replies to a pending duel with a plain move. Only the challenged opponent may call it; going second behind the challenger's hidden commitment is what keeps this fair.
- OID
- 0ec89d…7439:20
Accept details
Reveal
func(id string, moveStr string, salt string) stringReveal settles an accepted duel. Only the original challenger may call it, and only with the exact move+salt that produced their commitment.
- OID
- 0ec89d…7439:21
Reveal details
outcomeMsg
func(d *v0.duel) string- OID
- 0ec89d…7439:22
outcomeMsg details
ClaimForfeit
func(id string) stringClaimForfeit lets the opponent collect a default win when the challenger dodges revealing (e.g. because they saw the opponent's move and knew they'd lose) past the reveal window.
- OID
- 0ec89d…7439:23
ClaimForfeit details
Cancel
func(id string) stringCancel withdraws a still-pending duel. Only the challenger may cancel, and only before the opponent accepts.
- OID
- 0ec89d…7439:24
Cancel details
escapeInline
func(s string) stringescapeInline neutralizes markdown-active characters in untrusted text before it's embedded inline in Render output.
- OID
- 0ec89d…7439:25
escapeInline details
renderHome
func() string- OID
- 0ec89d…7439:26
renderHome details
renderDuel
func(id string) string- OID
- 0ec89d…7439:27
renderDuel details
renderPlayer
func(rawAddr string) string- OID
- 0ec89d…7439:28
renderPlayer details
Render
func(path string) stringRender shows the duel lobby at "", a specific duel when path is a numeric ID, or one player's record when path is their bech32 address.
- OID
- 0ec89d…7439:29