cols
untyped bigintValue
(7 <untyped> bigint)
rows
untyped bigintValue
(6 <untyped> bigint)
board
typeboard is indexed \[column]\[row]; row 0 is the bottom. 0 = empty, 1/2 = player.
Value
connect4.board
moveTimeout
time.DurationValue
<zero>
maxOfferTTL
untyped bigint// minutes
Value
(60 <untyped> bigint)
minStake
untyped bigint// ugnot
Value
(1000000 <untyped> bigint)
denom
untyped stringValue
"ugnot"
Status
typeValue
connect4.Status
Open
connect4.StatusValue
<zero>
Playing
connect4.StatusValue
<zero>
Won
connect4.StatusValue
<zero>
Draw
connect4.StatusValue
<zero>
Void
connect4.StatusValue
<zero>
Cancelled
connect4.StatusValue
<zero>
Game
typeValue
connect4.Game
Stats
typeValue
connect4.Stats
games
v0.Tree// key(id) -> \*Game
- OID
- 098db0…62ae:4
games details
active
v0.Tree// key(id) -> \*Game, only Open and Playing
- OID
- 098db0…62ae:6
active details
stats
v0.Tree// address -> \*Stats
- OID
- 098db0…62ae:8
stats details
nextID
intValue
2
fee
int64// ugnot per decisive game
Value
100000
feesCollected
int64Value
100000
owner
*v0.Ownable- OID
- 098db0…62ae:13
owner details
Offer
func(opponent .uverse.address, validFor int, commitment string) intOffer posts a game open for validFor minutes. The stake is the ugnot sent with the call. A non-empty opponent makes the offer private. commitment is the lowercase hex sha256 of a secret passphrase, revealed after Accept.
- OID
- 098db0…62ae:15
Offer details
validateOffer
func(stake int64, validFor int, opponent .uverse.address, commitment string) []stringvalidateOffer returns every rule an offer breaks. Offer panics with the first; the "new" page lists them all before anyone signs.
- OID
- 098db0…62ae:17
validateOffer details
Accept
func(id int)Accept joins an open offer by sending exactly its stake. The creator then has 90s to Reveal, which picks the first mover.
- OID
- 098db0…62ae:18
Accept details
Reveal
func(id int, passphrase string)Reveal discloses the creator's passphrase, which picks the first mover. It must come within 90s of Accept.
- OID
- 098db0…62ae:19
Reveal details
Play
func(id int, column int)Play drops a piece in column (1-7).
- OID
- 098db0…62ae:20
Play details
ClaimTimeout
func(id int)ClaimTimeout settles a game whose move clock ran out. Anyone may call it.
- OID
- 098db0…62ae:21
ClaimTimeout details
Resign
func(id int)Resign concedes a game in progress.
- OID
- 098db0…62ae:22
Resign details
Cancel
func(id int)Cancel withdraws an open offer and refunds the creator. The creator may cancel at any time; anyone may once the offer has expired.
- OID
- 098db0…62ae:23
Cancel details
SetFee
func(amount int64)SetFee changes the flat house fee, in ugnot, for new offers. Games already offered keep the fee they were created with.
- OID
- 098db0…62ae:24
SetFee details
WithdrawFees
func(to .uverse.address)WithdrawFees sends all collected fees to to.
- OID
- 098db0…62ae:25
WithdrawFees details
TransferOwnership
func(newOwner .uverse.address)- OID
- 098db0…62ae:26
TransferOwnership details
received
func() int64received returns the ugnot sent with a direct user call. OriginSend only describes a real payment to this realm when the caller is an EOA using maketx call; see docs/resources/effective-gno.md.
- OID
- 098db0…62ae:27
received details
noCoins
func()noCoins guards calls that take no payment: coins sent with them would be stuck in the realm.
- OID
- 098db0…62ae:28
noCoins details
sha256Hex
func(s string) string- OID
- 098db0…62ae:29
sha256Hex details
isHexSHA256
func(s string) bool- OID
- 098db0…62ae:30
isHexSHA256 details
settleWin
func(g *connect4.Game, winner .uverse.address)- OID
- 098db0…62ae:31
settleWin details
settleDraw
func(g *connect4.Game)- OID
- 098db0…62ae:32
settleDraw details
settleVoid
func(g *connect4.Game)- OID
- 098db0…62ae:33
settleVoid details
finish
func(g *connect4.Game, s connect4.Status)- OID
- 098db0…62ae:34
finish details
send
func(to .uverse.address, amount int64)- OID
- 098db0…62ae:35
send details
statsOf
func(addr .uverse.address) *connect4.Stats- OID
- 098db0…62ae:36
statsOf details
key
func(id int) stringkey zero-pads ids so avl iteration order matches creation order.
- OID
- 098db0…62ae:37
key details
get
func(id int) *connect4.Game- OID
- 098db0…62ae:38
get details
mustGet
func(id int) *connect4.Game- OID
- 098db0…62ae:39
mustGet details
red
untyped stringBoard colours. gnoweb only embeds SVG as data-URI images, so each column is its own image, wrapped in its Play link while the game is being played.
Value
"#e53935"
yellow
untyped stringBoard colours. gnoweb only embeds SVG as data-URI images, so each column is its own image, wrapped in its Play link while the game is being played.
Value
"#fdd835"
hole
untyped stringBoard colours. gnoweb only embeds SVG as data-URI images, so each column is its own image, wrapped in its Play link while the game is being played.
Value
"#ffffff"
boardBlue
untyped stringBoard colours. gnoweb only embeds SVG as data-URI images, so each column is its own image, wrapped in its Play link while the game is being played.
Value
"#1565c0"
lastMoveStroke
untyped stringBoard colours. gnoweb only embeds SVG as data-URI images, so each column is its own image, wrapped in its Play link while the game is being played.
Value
"#212121"
winStroke
untyped stringBoard colours. gnoweb only embeds SVG as data-URI images, so each column is its own image, wrapped in its Play link while the game is being played.
Value
"#00e676"
cellPx
untyped bigintBoard colours. gnoweb only embeds SVG as data-URI images, so each column is its own image, wrapped in its Play link while the game is being played.
Value
(48 <untyped> bigint)
headerPx
untyped bigintBoard colours. gnoweb only embeds SVG as data-URI images, so each column is its own image, wrapped in its Play link while the game is being played.
Value
(20 <untyped> bigint)
pieceColor
[3]string- OID
- 098db0…62ae:41
pieceColor details
pieceName
[3]string- OID
- 098db0…62ae:43
pieceName details
Render
func(path string) stringRender serves "" (lobby and leaderboards), "new" (offer form) and "game/\<id>" (one game with every action its state allows). Everything written comes from realm state or from query values that have been validated and re-formatted; raw path input is never echoed.
- OID
- 098db0…62ae:44
Render details
pageURL
func(page string) stringpageURL links to one of this realm's Render pages. The realm path is read at runtime, like txlink does, so links work wherever the realm is deployed.
- OID
- 098db0…62ae:46
pageURL details
gameLink
func(base string, id int) string- OID
- 098db0…62ae:47
gameLink details
renderLobby
func() string- OID
- 098db0…62ae:48
renderLobby details
renderNew
func(query string) stringrenderNew shows the offer form and, once submitted, a single Offer link with the stake and every argument prefilled (gnoweb cannot edit .send).
- OID
- 098db0…62ae:49
renderNew details
renderGame
func(g *connect4.Game) string- OID
- 098db0…62ae:50
renderGame details
boardView
func(g *connect4.Game, now time.Time) stringboardView draws the board. While a move can be played it is 7 column images, each wrapped in its Play link (gnoweb lays linked images out side by side). Otherwise it is one image of all 7 columns, since gnoweb stacks bare images vertically. The last move gets a dark ring, a winning line a green one.
- OID
- 098db0…62ae:51
boardView details
drawColumn
func(canvas *v0.Canvas, g *connect4.Game, win *[7][6]bool, c int, x int) stringdrawColumn draws column c at horizontal offset x and returns its alt text.
- OID
- 098db0…62ae:52
drawColumn details
acceptURL
func(g *connect4.Game) string- OID
- 098db0…62ae:53
acceptURL details
digits
func(s string) bool- OID
- 098db0…62ae:54
digits details
openTo
func(g *connect4.Game) string- OID
- 098db0…62ae:55
openTo details
parseGNOT
func(s string) (int64, bool)parseGNOT parses a decimal GNOT amount ("10", "2.5") into ugnot.
- OID
- 098db0…62ae:56
parseGNOT details
leaderboard
func(score func(...), format func(...)) stringleaderboard renders the top 10 players by score, skipping zero scores.
- OID
- 098db0…62ae:57
leaderboard details
gnot
func(ugnot int64) stringgnot formats ugnot as GNOT with up to 6 decimals.
- OID
- 098db0…62ae:58
gnot details
remaining
func(d time.Duration) string- OID
- 098db0…62ae:59
remaining details
orNone
func(a .uverse.address) string- OID
- 098db0…62ae:60