format
untyped stringHow golf's rows are kept in store: strings, never golf's own types (a value of a realm's type kept in another realm would carry this realm's methods into it, and would not outlive these rules). Each is its format's version, then its fields, each as its length, ":" and itself (store's own rows are so): a row reads back by its lengths, not by a scan of every byte (a scan, as strings.Split, costs several times more gas), whatever its fields hold. A later version of the rules reads every format ever written, row by row.
Value
"1"
join
func(fs []string) string- OID
- 07fad8…0765:3
join details
fields
func(s string, what string, n int) []stringfields is a row's fields, its format checked: n of them, or it panics.
- OID
- 07fad8…0765:5
fields details
itoa
func(n int) string- OID
- 07fad8…0765:6
itoa details
i64
func(n int64) string- OID
- 07fad8…0765:7
i64 details
ftoa
func(x float64) string- OID
- 07fad8…0765:8
ftoa details
btoa
func(b bool) string- OID
- 07fad8…0765:9
btoa details
atoi
func(s string) int- OID
- 07fad8…0765:10
atoi details
atoi64
func(s string) int64- OID
- 07fad8…0765:11
atoi64 details
atof
func(s string) float64- OID
- 07fad8…0765:12
atof details
encodeEntry
func(e *v2.entry) string- OID
- 07fad8…0765:13
encodeEntry details
decodeEntry
func(s string) *v2.entry- OID
- 07fad8…0765:14
decodeEntry details
encodeRound
func(r *v2.round) string- OID
- 07fad8…0765:15
encodeRound details
decodeRound
func(s string) *v2.round- OID
- 07fad8…0765:16
decodeRound details
encodeRow
func(r *v2.row) string- OID
- 07fad8…0765:17
encodeRow details
decodeRow
func(s string) *v2.row- OID
- 07fad8…0765:18
decodeRow details
wearCells
untyped bigintValue
(128 <untyped> bigint)
maxData
untyped bigintmaxData bounds a version's data: a hole at every limit of the format is about 21 KB.
Value
(32768 <untyped> bigint)
Publish
func(slot string, hexData string, note string) stringPublish puts a course hole's data into its slot as its next version and returns the new id ("garden/7/v2"). Only the owner can. hexData is the hole as course.Encode wrote it, in hex. slot must be the data's own world and order ("garden/7", order 1 to 999), so a mis-edited file cannot replace the wrong hole; the course holds at most 9999 slots (maxCourse). Data identical to the current version's is refused. The version it replaces is archived: its records stay, its bests leave the course standings. note (at most 140 characters, cleaned) says why.
- OID
- 07fad8…0765:19
Publish details
publishNow
func(slot string, hexData string, note string) string- OID
- 07fad8…0765:21
publishNow details
PublishMine
func(slug string, hexData string, note string) stringPublishMine publishes a community hole of the caller's own and returns its id: "\<caller>/\<slug>/v1", then v2 and on. Anyone can while publishing is open (SetPublishing); only the same address adds versions. slug is 1 to 32 of a-z, 0-9 and "-". The data is checked as Publish checks it, its world and order aside; its name and note carry no web address. It is playable and recorded, in no cup and not in the course ranking; a new version of a hidden hole stays hidden. The publisher pays the storage deposit (about half a GNOT a version), and nothing published can be deleted.
- OID
- 07fad8…0765:22
PublishMine details
publishMineNow
func(slug string, hexData string, note string) string- OID
- 07fad8…0765:23
publishMineNow details
newestRow
func(a string) stringnewestRow is the height of an author's newest row in byAuthor ("\<address> \<height> \<slug>"), "" if they have none.
- OID
- 07fad8…0765:24
newestRow details
newestRowBut
func(a string, but string) stringnewestRowBut is newestRow with the row but left out ("" if it was their only one).
- OID
- 07fad8…0765:25
newestRowBut details
moveAuthor
func(a string, was string, now string)moveAuthor moves an author's own row in byAuthor (recentKey(height, address)) from the height was to now, "" for none: it stays at their newest row's, and goes with their last.
- OID
- 07fad8…0765:26
moveAuthor details
linkish
func(s string) boollinkish spots a web address in a community hole's name or note: "www.", a dot between a letter or digit and two letters ("claim.xyz", "t.me"; not "e.g."), or an IP address, look-alike dots (.。․﹒) read as dots, letters in any case. Basic (the owner can Hide what gets past) and strict on purpose ("St.Andrews" is refused). It reads s a byte at a time: every mark is ASCII, so a non-ASCII character is decoded only to tell İ and the Kelvin sign (which lower-case to ASCII), the look-alike dots and spaces apart.
- OID
- 07fad8…0765:27
linkish details
isLower
func(c uint8) bool- OID
- 07fad8…0765:28
isLower details
isDigit
func(c uint8) bool- OID
- 07fad8…0765:29
isDigit details
decodeData
func(hexData string) (*course.Simple, string, string)decodeData checks a version's data as it arrives: hex, GG1 within the format's limits, stored lengths bit-exact (DecodeChecked: every later Decode trusts them), and in the one form Encode gives.
- OID
- 07fad8…0765:30
decodeData details
nothingNew
func(old *v2.entry) stringnothingNew refuses data identical to the alias's current version: it would reset the hole's ranking for nothing.
- OID
- 07fad8…0765:31
nothingNew details
dataEntry
func(alias string, n int, h *course.Simple, by .uverse.address, sum string, note string) *v2.entry- OID
- 07fad8…0765:32
dataEntry details
worlds
[]struct{...}worlds is the course's worlds in play order, with their names on the page.
- OID
- 07fad8…0765:34
worlds details
worldRank
func(w string) intworldRank is a world's place among worlds; any other comes after.
- OID
- 07fad8…0765:40
worldRank details
slotKey
func(world string, order int) stringslotKey is a slot's key: its world's rank, the world, and the order in three digits, so the slots tree is in course order.
- OID
- 07fad8…0765:41
slotKey details
slotKeyOf
func(slot string) (string, bool)slotKeyOf reads a slot, "world/order" (as "garden/7"), into its key.
- OID
- 07fad8…0765:42
slotKeyOf details
validSlug
func(s string) bool- OID
- 07fad8…0765:43
validSlug details
HoleData
func(hole string) stringHoleData is a version's GG1, in hex, as it was published (an alias gives its current version's): what a later version of the rules or an auditor reads back.
- OID
- 07fad8…0765:44
HoleData details
Current
func(alias string) stringCurrent is the id of the version an alias ("garden/7", "\<address>/\<slug>") plays now, "" if the alias has none.
- OID
- 07fad8…0765:45
Current details
Versions
func(alias string) stringVersions is every version of an alias, oldest first (the newest pageMax if there are more): its id, number, the height it was published at, by whom, its data's sha256, its note, and the version that took its place. slot is the alias, "" (and no versions) for one that has none.
- OID
- 07fad8…0765:46
Versions details
firstVersion
func(now *v2.entry) intfirstVersion is the oldest of now's versions a list shows: the newest pageMax are (now is its alias's current version).
- OID
- 07fad8…0765:47
firstVersion details
BestOf
func(hole string, mode string, player .uverse.address) intBestOf is a player's best finished round on a hole in a mode, 0 if none.
- OID
- 07fad8…0765:48
BestOf details
featuredRead
untyped bigintfeaturedRead is how much of the course ranking the picks look at: its first page; podium, its first places, which get no card of their own.
Value
(50 <untyped> bigint)
podium
untyped bigintfeaturedRead is how much of the course ranking the picks look at: its first page; podium, its first places, which get no card of their own.
Value
(3 <untyped> bigint)
pick
typepick is a player put forward, and why.
Value
v2.pick
today
func() int64today is the day, a number: the picks hold for it and change with it (block time).
- OID
- 07fad8…0765:49
today details
draw
func(player string, day int64) uint32draw is a player's draw for a day: FNV-1a over their address, seeded with the day (featured.ts draw: the same numbers, so the same picks).
- OID
- 07fad8…0765:51
draw details
featured
func(m int, n int) []v2.pickfeatured is up to n picks from the course ranking in mode m: a fast start (a third of the course or less, at par or better), the best average against par (a third of the course played, nine holes at least), and today's picks for the rest; never the first three places.
- OID
- 07fad8…0765:52
featured details
countTag
func(ps []v2.pick, tag string) int- OID
- 07fad8…0765:53
countTag details
max1
func(n int) int- OID
- 07fad8…0765:54
max1 details
nine
func(n int) int- OID
- 07fad8…0765:55
nine details
featuredRows
func(m int) stringfeaturedRows is the hub's records to beat in mode m, as markdown lines.
- OID
- 07fad8…0765:56
featuredRows details
maxPower
untyped bigdecValue
(10.0 <untyped> bigdec)
maxShots
untyped bigintValue
(12 <untyped> bigint)
errShot
untyped stringThe refusals said in more than one place.
Value
"golf: a shot is an angle and a power between 0 and 10"
errFine
untyped stringThe refusals said in more than one place.
Value
"golf: a shot's angle and power go in steps of 0.01, as the game sends them"
errStrokeLimit
untyped stringThe refusals said in more than one place.
Value
"golf: this round is over its stroke limit, Reset to play again"
errShotTooHeavy
untyped stringThe refusals said in more than one place.
Value
"golf: one shot on this hole could cost more than a transaction can replay"
errTooStormy
untyped stringThe refusals said in more than one place.
Value
"golf: in its dearest weather, a commit on this hole would leave too little room for a shot"
errUnknownHole
untyped stringThe refusals said in more than one place.
Value
"golf: unknown hole: "
entry
typeValue
v2.entry
courseHoles
v2.viewThe versions: the course's, current and archived, and everyone else's: id -> encodeEntry.
- OID
- 07fad8…0765:58
courseHoles details
community
v2.viewThe versions: the course's, current and archived, and everyone else's: id -> encodeEntry.
- OID
- 07fad8…0765:60
community details
saveEntry
func(e *v2.entry)saveEntry keeps a version as it is now: every call that changes one ends with it.
- OID
- 07fad8…0765:61
saveEntry details
record
typerecord is the hole's record in one mode: who holds it, in how many strokes, 0 if never completed.
Value
v2.record
bestsOf
func(id string, m int) v2.view- OID
- 07fad8…0765:63
bestsOf details
bestOf
func(r *v2.round) stringbestOf is how a best is kept: "\<strokes> \<height> \<period> \<shots>". The height ranks it before a later tie (boardKey); the period and shots let Ghost replay it in its own weather. The mode is in the key.
- OID
- 07fad8…0765:64
bestOf details
errBest
untyped stringerrBest is a best not as bestOf writes it: never written, refused if read.
Value
"golf: a best not as bestOf writes it: "
bestStrokes
func(s string) intbestStrokes is a kept best's strokes, 0 for none ("").
- OID
- 07fad8…0765:65
bestStrokes details
bestFields
func(s string) (int64, int64, string)bestFields is a kept best's height, period and shots.
- OID
- 07fad8…0765:66
bestFields details
newEntry
func(id string, name string, par int, world string, order float64) *v2.entry- OID
- 07fad8…0765:67
newEntry details
draining
typedraining is an archived hole's drain, per mode: the next player to take out, and whether all are out. The players whose first finish came after it was archived (never counted, so never taken out) are its fresh rows.
Value
v2.draining
copiesOf
func(id string, m int) v2.view- OID
- 07fad8…0765:68
copiesOf details
copyAngle
untyped bigdec// degrees, round the circle
Value
(0.05 <untyped> bigdec)
copyPower
untyped bigdecHow near a round must be to a record already on the board, shot for shot, to be that record sent again: a player's pull never lands this close to another's, three shots running.
Value
(0.02 <untyped> bigdec)
copyMin
untyped bigint// shots: two people keying a short round send alike
Value
(3 <untyped> bigint)
copyDepth
untyped bigint// the board's first page: the records worth copying
Value
(10 <untyped> bigint)
copyOf
func(e *v2.entry, p string, shots string) boolcopyOf reports whether shots are a record of a board's first page (either mode's: the modes differ by the client's aim line alone, so a round replays the same in both; another player's) sent again: as many shots, each within copyAngle and copyPower, three shots or more, one of them pulled (not keyed: a whole degree, or a power on 0.5, the keyboard's and a typed form's). The tick is not compared: on most holes it changes nothing, and on a timed one another tick of the same beat plays the same.
- OID
- 07fad8…0765:69
copyOf details
keyed
func(a float64, p float64) boolkeyed is a shot a keyboard or a form sends: a whole degree, or a power on 0.5.
- OID
- 07fad8…0765:70
keyed details
alike
func(a []string, b []string) bool- OID
- 07fad8…0765:71
alike details
round
typeValue
v2.round
assisted
untyped bigintA round is played in one of two modes, each with its own records and rankings: assisted (the full aim preview) or pro (the preview cut short). The chain cannot see a screen: the mode is the player's word.
Value
(0 <untyped> bigint)
pro
untyped bigintA round is played in one of two modes, each with its own records and rankings: assisted (the full aim preview) or pro (the preview cut short). The chain cannot see a screen: the mode is the player's word.
Value
(1 <untyped> bigint)
modes
untyped bigintA round is played in one of two modes, each with its own records and rankings: assisted (the full aim preview) or pro (the preview cut short). The chain cannot see a screen: the mode is the player's word.
Value
(2 <untyped> bigint)
modeOf
func(name string) intmodeOf reads a mode's name: "assisted" (or "") or "pro"; anything else panics rather than answer for another mode.
- OID
- 07fad8…0765:72
modeOf details
modeNames
[2]string- OID
- 07fad8…0765:74
modeNames details
modeTitles
[2]stringmodeTitles is how the pages head a mode's board.
- OID
- 07fad8…0765:76
modeTitles details
holeData
v2.viewThe indexes: collections of store (kv.gno), shared by every version and mode, made at its deploy: a first player pays for their own rows only.
- OID
- 07fad8…0765:78
holeData details
slots
v2.viewThe indexes: collections of store (kv.gno), shared by every version and mode, made at its deploy: a first player pays for their own rows only.
- OID
- 07fad8…0765:80
slots details
aliases
v2.viewThe indexes: collections of store (kv.gno), shared by every version and mode, made at its deploy: a first player pays for their own rows only.
- OID
- 07fad8…0765:82
aliases details
byAuthor
v2.viewThe indexes: collections of store (kv.gno), shared by every version and mode, made at its deploy: a first player pays for their own rows only.
- OID
- 07fad8…0765:84
byAuthor details
archived
v2.viewThe indexes: collections of store (kv.gno), shared by every version and mode, made at its deploy: a first player pays for their own rows only.
- OID
- 07fad8…0765:88
archived details
totals
[2]v2.viewThe indexes: collections of store (kv.gno), shared by every version and mode, made at its deploy: a first player pays for their own rows only.
- OID
- 07fad8…0765:90
totals details
ranks
[2]v2.viewThe indexes: collections of store (kv.gno), shared by every version and mode, made at its deploy: a first player pays for their own rows only.
- OID
- 07fad8…0765:94
ranks details
idle
[2]v2.viewThe indexes: collections of store (kv.gno), shared by every version and mode, made at its deploy: a first player pays for their own rows only.
- OID
- 07fad8…0765:98
idle details
meta
v2.viewThe indexes: collections of store (kv.gno), shared by every version and mode, made at its deploy: a first player pays for their own rows only.
- OID
- 07fad8…0765:102
meta details
archiving
func() []stringarchiving is the archived holes still in the standings, oldest first (drain).
- OID
- 07fad8…0765:103
archiving details
setArchiving
func(ids []string)- OID
- 07fad8…0765:104
setArchiving details
row
typerow is one player's standing across the course: their best on each hole counted, summed, and those holes' pars, summed. Its score against par, strokes - par, is what ranks it after its holes.
Value
v2.row
topSize
untyped bigintValue
(10 <untyped> bigint)
named
func(player string) boolnamed reports whether a player has a gno.land name (r/sys/users). Only named players rank: a name takes a registration, so a script cannot fill the boards with free addresses. Every finish is still kept.
- OID
- 07fad8…0765:105
named details
nameOf
func(player string) stringnameOf is a named player's name, "" for anyone else.
- OID
- 07fad8…0765:106
nameOf details
nameish
func(n string) boolnameish is a name as r/sys/users registers it (a-z, then a-z, 0-9, "\_" and "-", at most 64), checked again because the pages print names in links.
- OID
- 07fad8…0765:107
nameish details
find
func(id string) *v2.entryfind is the hole with this exact id, nil if none. Within a call that writes (begin), a version is one object, however often it is found: a finish on an archived hole and the drain it runs change the same one, and the call keeps it once as it ends (flush forgets them all). A read caches nothing: called within another realm's transaction, it would keep its cache in this realm's state, stale once the rules change.
- OID
- 07fad8…0765:108
find details
current
func(alias string) stringcurrent is the id an alias points at now: a course slot's or a community hole's current version; "" if it is neither.
- OID
- 07fad8…0765:109
current details
mustHole
func(id string) *v2.entrymustHole is the hole a write names: its exact id. An alias is refused: a new version may have taken its place since the round's shots were chosen.
- OID
- 07fad8…0765:110
mustHole details
readHole
func(id string) *v2.entryreadHole is the hole a read names: an exact id, or an alias for its current version.
- OID
- 07fad8…0765:111
readHole details
recentKey
func(height int64, what string) stringrecentKey orders by height, then by what is at that height.
- OID
- 07fad8…0765:112
recentKey details
pad
func(n int, width int) stringpad writes n in width digits, zeros first: keys that sort as numbers.
- OID
- 07fad8…0765:113
pad details
rankKey
func(r *v2.row) stringrankKey orders the course ranking: most holes first, then the best score against par (a hole at par counts the same whatever its par), then the first there, then the address. The score is signed: vsParBias puts it in seven digits. The holes take five: a standing can count more than the course's slots while a republished hole drains (its old best still counts, its new one adds a hole), so they get room well past maxCourse.
- OID
- 07fad8…0765:114
rankKey details
maxCourse
untyped bigintmaxCourse bounds the course's slots (Publish); a standing's holes are at most those plus the archived versions drain has not taken it out of yet. vsParBias is more than a standing can be under or over par: a hole is -18 to +59 (1 to 60 strokes, par 1 to 19), so a full course at most 9999 \* 59 = 589,941 over, 179,982 under, and the seven digits hold 55,555 holes.
Value
(9999 <untyped> bigint)
vsParBias
untyped bigintmaxCourse bounds the course's slots (Publish); a standing's holes are at most those plus the archived versions drain has not taken it out of yet. vsParBias is more than a standing can be under or over par: a hole is -18 to +59 (1 to 60 strokes, par 1 to 19), so a full course at most 9999 \* 59 = 589,941 over, 179,982 under, and the seven digits hold 55,555 holes.
Value
(1000000 <untyped> bigint)
boardKey
func(v string, player string) stringboardKey orders a hole's board by each player's best v: fewest strokes, then the first to make them (a best's shots are public: whoever replays them ties it and ranks after), then the address.
- OID
- 07fad8…0765:115
boardKey details
boardStrokes
func(k string) intboardStrokes is the strokes of a board's key: always its three digits.
- OID
- 07fad8…0765:116
boardStrokes details
setRow
func(m int, r *v2.row, n int, strokes int, par int, at int64)setRow moves a player's standing, as of height at, and keeps the ranking in step (and the standing itself). A standing with no hole left is not freed, nor its key, which moves to idle: its deposit is the player's, and freeing it would refund whoever drained it. It moves back at the player's next hole.
- OID
- 07fad8…0765:117
setRow details
improve
func(m int, player string, par int, was int, best int)improve moves a player's standing by a new best on an official hole of par par (was: their old best there, 0 if none): only those count, or anyone's own hole would be a way to the top. The standing is kept, not recomputed, so a finish costs the same however many play.
- OID
- 07fad8…0765:118
improve details
retire
func(old *v2.entry, next string)retire archives an official hole replaced by next. Its bests stay there as its records but leave the course standings, in batches (drain): the Publish takes retireBatch, each course finish finishBatch, a Drain up to drainMax.
- OID
- 07fad8…0765:119
retire details
retireBatch
untyped bigintHow many archived players a Publish, a course finish and a Drain take out of the standings: sized so none costs more however many played.
Value
(150 <untyped> bigint)
finishBatch
untyped bigintHow many archived players a Publish, a course finish and a Drain take out of the standings: sized so none costs more however many played.
Value
(4 <untyped> bigint)
drainMax
untyped bigintHow many archived players a Publish, a course finish and a Drain take out of the standings: sized so none costs more however many played.
Value
(400 <untyped> bigint)
drain
func(n int)drain takes up to n archived players out of the standings, oldest archived hole first.
- OID
- 07fad8…0765:120
drain details
Drain
func(n int) intDrain takes up to n players (1 to 400) of archived holes out of the course standings, sooner than the finishes would, and returns how many archived holes still have players in them. Anyone can call it. A standing it empties is kept at 0 holes (setRow): nothing is refunded to the caller.
- OID
- 07fad8…0765:121
Drain details
counts
func(e *v2.entry, m int, player string, was int) boolcounts reports whether a best on e by player (was: their previous best, 0 if none) moves their standing: e is a current official hole, or an archived one whose drain has not reached them yet and where they already counted. A first finish on an archived hole never counts.
- OID
- 07fad8…0765:122
counts details
Launch
func(hole string, angle float64, power float64) stringLaunch plays one shot of the caller's round on hole (an exact id): angle in degrees (0 = right, 90 = down), power in (0, 10]. It is how gnoweb plays, with no aim preview, so its rounds are pro rounds. It answers with where the ball stopped, or the score if holed; PlayRoundAt commits many shots.
- OID
- 07fad8…0765:123
Launch details
launchNow
func(hole string, angle float64, power float64) string- OID
- 07fad8…0765:124
launchNow details
aim
func(from physics.Vec2, cup physics.Vec2) (float64, float64)aim is the angle, in the shot's degrees, and the straight-line distance from a ball to the cup: walls and slopes are the player's to allow for.
- OID
- 07fad8…0765:125
aim details
PlayRound
func(hole string, shots string) stringPlayRound is PlayRoundAt in the current period, for a caller with none to give (a form, a script); a round under way keeps its own. Prefer PlayRoundAt: a commit included after the weather turned is then played in the weather its shots were chosen in.
- OID
- 07fad8…0765:126
PlayRound details
playRoundNow
func(hole string, shots string) string- OID
- 07fad8…0765:127
playRoundNow details
PlayRoundAt
func(hole string, shots string, period int64) stringPlayRoundAt replays shots into the caller's assisted round on hole (an exact id), continuing it, in the weather of period: the current one or the one before, and a round under way keeps its own. The client sends decisions, never outcomes: the chain replays them. shots is "angle,power\[,tick];…" (MsgCall carries no slice), at most 12, fewer on a heavy hole: a commit past the work budget is refused with the number of shots that fit, and the rest goes in the next commit.
- OID
- 07fad8…0765:128
PlayRoundAt details
playRoundAtNow
func(hole string, shots string, period int64) string- OID
- 07fad8…0765:129
playRoundAtNow details
PlayRoundPro
func(hole string, shots string, period int64) stringPlayRoundPro is PlayRoundAt for a round played in pro mode: the aim preview cut short. It counts on the pro records and rankings only.
- OID
- 07fad8…0765:130
PlayRoundPro details
playRoundProNow
func(hole string, shots string, period int64) string- OID
- 07fad8…0765:131
playRoundProNow details
playRound
func(e *v2.entry, player .uverse.address, shots string, period int64, mode int) string- OID
- 07fad8…0765:132
playRound details
otherMode
func(r *v2.round) stringotherMode refuses to go on with a round in a mode it was not started in.
- OID
- 07fad8…0765:133
otherMode details
shotList
func(shots string) []stringshotList is a commit's shots: the non-empty entries of "a,p;a,p;…", at least one and at most maxShots.
- OID
- 07fad8…0765:134
shotList details
work
typework is a commit's estimated gas so far. A shot counts the larger of its path's estimate and its Shot.Work's, plus its pulses' set-up, on top of what the commit spent before its shots (fixed: decoding, forecast). A shot that could pass workBudget is refused before anything is kept, and each is played under a work cap (physics.Field.Cap), so no commit can pass it; the client mirrors the model. An estimate, not a gas meter: see docs/golf.md, "The work budget".
Value
v2.work
workBudget
untyped bigintThe budget: of the 2e9 gas a wallet lets a transaction simulate, 1.4e9 for a commit, decoding and forecast included; the rest for package loads and bookkeeping.
Value
(1400000000 <untyped> bigint)
workPerShot
untyped bigintThe budget: of the 2e9 gas a wallet lets a transaction simulate, 1.4e9 for a commit, decoding and forecast included; the rest for package loads and bookkeeping.
Value
(10000000 <untyped> bigint)
workPerWall
untyped bigintThe budget: of the 2e9 gas a wallet lets a transaction simulate, 1.4e9 for a commit, decoding and forecast included; the rest for package loads and bookkeeping.
Value
(150000 <untyped> bigint)
workPerPoint
untyped bigintThe budget: of the 2e9 gas a wallet lets a transaction simulate, 1.4e9 for a commit, decoding and forecast included; the rest for package loads and bookkeeping.
Value
(1200000 <untyped> bigint)
workPerPiece
untyped bigintThe budget: of the 2e9 gas a wallet lets a transaction simulate, 1.4e9 for a commit, decoding and forecast included; the rest for package loads and bookkeeping.
Value
(15000 <untyped> bigint)
workPerUnit
untyped bigintThe budget: of the 2e9 gas a wallet lets a transaction simulate, 1.4e9 for a commit, decoding and forecast included; the rest for package loads and bookkeeping.
Value
(1000 <untyped> bigint)
workPerPulseWall
untyped bigintThe budget: of the 2e9 gas a wallet lets a transaction simulate, 1.4e9 for a commit, decoding and forecast included; the rest for package loads and bookkeeping.
Value
(700000 <untyped> bigint)
workPerPulsePost
untyped bigintThe budget: of the 2e9 gas a wallet lets a transaction simulate, 1.4e9 for a commit, decoding and forecast included; the rest for package loads and bookkeeping.
Value
(200000 <untyped> bigint)
decodeBase
untyped bigintDecoding a hole's data costs at most decodeBase and decodePerByte a byte.
Value
(6000000 <untyped> bigint)
decodePerByte
untyped bigintDecoding a hole's data costs at most decodeBase and decodePerByte a byte.
Value
(4000 <untyped> bigint)
fixedGas
func(e *v2.entry, fc course.Forecast) int64fixedGas is what a commit on e spends before its shots, in the forecast fc: decoding the hole, and drawing the forecast.
- OID
- 07fad8…0765:135
fixedGas details
storeGas
untyped bigintstoreGas is what a commit spends keeping its rows in store, on top of v1's work: reading the hole, its version and the round across the realm, decoding them, and its writes in one batch. Measured at 20.6M on the heaviest commit that does not finish (z\_worst\_play\_filetest, against v1's): 25M, counted before the shots and at publish (worstGas). A finish spends some 30M to 40M more there (its best, the board, the standing, the drain's share), outside the work budget, as v1's finish was: the room between the budget and what a transaction may ask covers it.
Value
(25000000 <untyped> bigint)
decodeGas
func(size int) int64decodeGas bounds decoding size bytes of a hole's data.
- OID
- 07fad8…0765:136
decodeGas details
maxShotGas
untyped bigintmaxShotGas bounds a hole's heaviest shot (shotBound and its pulses' set-up): a hole past it is refused at publish.
Value
(1300000000 <untyped> bigint)
minShotWork
untyped bigintminShotWork is the work, in the physics' units, a commit's first shot may always do whatever the weather: four fifths of MaxWork. A shot is capped at what is left of the budget (work.next), so a hole whose dearest weather would leave less is refused at publish (worstGas): on a published hole, every shot of less than minShotWork plays out in any weather (as a commit's first, if need be), and an author whose board is too heavy is told at publish, not by a hole that misbehaves in the rain. A shot past it may be cut short; none is known: the course's heaviest real shot does 441,737 over the full grid of tee shots (mountain/16, full power, in a storm), and the heaviest found in an adversarial search 0.74 of MaxWork (docs/golf.md); the course's tightest room in its dearest weather is 839,278 (mountain/7), 39,278 over the floor.
Value
(800000 <untyped> bigint)
worstGas
func(h *course.Simple, size int) int64worstGas is what a commit on h (size bytes of data) spends up to a first shot of minShotWork in its dearest weather: decoding, the forecast at its most (course.WorstForecastWork), and the shot, its walls and its pulses' set-up, as work.next caps it.
- OID
- 07fad8…0765:137
worstGas details
newWork
func(h *course.Simple, weather []physics.Zone) *v2.worknewWork is a commit's work on a hole, before any shot: its walls and pieces, a pulse's as if always there, and the weather's.
- OID
- 07fad8…0765:138
newWork details
shotBound
func(walls int64) int64shotBound is the most one shot on a board of walls walls can cost: the physics ends a stroke at MaxWork, passing it by MaxWorkStep at most.
- OID
- 07fad8…0765:139
shotBound details
pieces
func(ws []physics.Wall, ps []physics.Post, zs []physics.Zone) int64pieces counts what a ball is tested against: each wall, post and zone, and each edge of a zone's polygon.
- OID
- 07fad8…0765:140
pieces details
Reset
func(hole string)Reset abandons the caller's round under way on hole (an exact id), freeing its storage: the next stroke starts a new one from the tee. A finished round is not kept (its best is), so a new one needs no Reset. With no round under way it does nothing, and says nothing.
- OID
- 07fad8…0765:141
Reset details
resetNow
func(hole string)- OID
- 07fad8…0765:142
resetNow details
validShot
func(angle float64, power float64) (float64, float64)validShot refuses what would poison a round, and what the game cannot send (a step finer than 0.01), and returns the shot as recorded. NaN and infinities pass every comparison, so they are refused by name. The power is quantized before it is checked (0.00001 would round to 0). The angle is brought into (-360, 360), so a huge one cannot overflow to NaN in the physics, and again after rounding (-359.99996 is -0, not -360).
- OID
- 07fad8…0765:143
validShot details
cents
func(x float64) boolcents reports whether x is a whole number of hundredths (as q4 left it).
- OID
- 07fad8…0765:144
cents details
resolve
func(shot physics.Shot, holed bool) (physics.Shot, bool)resolve checks what the physics returned for a stroke: a path a read may print, and a ball that is a number. A hole is anyone's data.
- OID
- 07fad8…0765:145
resolve details
back
func(h *course.Simple, from physics.Vec2, shot physics.Shot, holed bool) physics.Shotback brings a ball that came to rest off the board (a leak in a hole's walls) back to from, where the shot started; the stroke counts, with no penalty. Every stroke golf plays or replays goes through it.
- OID
- 07fad8…0765:146
back details
stroke
func(e *v2.entry, h *course.Simple, r *v2.round, player .uverse.address, angle float64, power float64, tick int, weather []physics.Zone) (physics.Shot, bool)stroke resolves one shot into the round and reports whether it was holed.
- OID
- 07fad8…0765:147
stroke details
seat
func(e *v2.entry, m int, p string, best string)seat puts a named player where their best puts them: on the hole's board, in its record if it tops it, and in the course ranking if they stand in it. Every finish does it, improved or not, so a player named since ranks.
- OID
- 07fad8…0765:148
seat details
bestOfPlayer
func(e *v2.entry, m int, p string) stringbestOfPlayer is a player's kept best on e in mode m, "" for none.
- OID
- 07fad8…0765:149
bestOfPlayer details
Claim
func() intClaim ranks the caller's bests kept while they had no name: on the boards of the course's current holes, in both modes, and in the course ranking. It returns how many bests it seated, and refuses a caller with no gno.land name. It reads the course's holes only, so it costs the same for everyone.
- OID
- 07fad8…0765:150
Claim details
claimNow
func() int- OID
- 07fad8…0765:151
claimNow details
maxRoundStrokes
untyped bigintmaxRoundStrokes bounds a round's history (Round shows it); maxPath the path a hole may return for a stroke (an honest one: a few hundred points).
Value
(60 <untyped> bigint)
maxPath
untyped bigintmaxRoundStrokes bounds a round's history (Round shows it); maxPath the path a hole may return for a stroke (an honest one: a few hundred points).
Value
(512 <untyped> bigint)
q4
func(x float64) float64q4 rounds to the precision a shot is recorded at.
- OID
- 07fad8…0765:152
q4 details
maxTick
untyped bigintmaxTick bounds the third field of a shot: any timed piece turns in fewer.
Value
(1023 <untyped> bigint)
parseShot
func(s string) (float64, float64, int)parseShot reads "angle,power" or "angle,power,tick". The tick is where the timed pieces were when the player let go (0 if absent), clamped to 0..maxTick.
- OID
- 07fad8…0765:153
parseShot details
clampTick
func(t string, shot string) intclampTick reads a tick: an optional sign and digits, clamped to 0..maxTick, even past what an int holds.
- OID
- 07fad8…0765:154
clampTick details
roundOf
func(e *v2.entry, h *course.Simple, player .uverse.address) *v2.roundroundOf is the player's round under way on e, or a new one from the tee, not stored: its commit stores it if it does not finish it.
- OID
- 07fad8…0765:155
roundOf details
maxName
untyped bigintmaxName and maxNote bound a hole's name and a version's note.
Value
(40 <untyped> bigint)
maxNote
untyped bigintmaxName and maxNote bound a hole's name and a version's note.
Value
(140 <untyped> bigint)
cleanName
func(n string) stringcleanName keeps a hole's name to one short line of plain text (cleanText), with at least a letter or a digit in it.
- OID
- 07fad8…0765:156
cleanName details
cleanText
func(n string, max int) stringcleanText keeps an author's text to one line of plain text, at most max characters: no control, format (Cf: bidi, zero-width, tags) or nonspacing (Mn: stacked accents, variation selectors) characters, no blank-looking ones, nothing that ends a markdown table cell or opens a link, a tag, an HTML entity, a strikethrough, a mention or an email link.
- OID
- 07fad8…0765:157
cleanText details
maxSkin
untyped bigintmaxSkin bounds a skin's length.
Value
(24 <untyped> bigint)
cleanSkin
func(s string) stringcleanSkin keeps a skin to what it is meant to be: a short lower-case id.
- OID
- 07fad8…0765:158
cleanSkin details
EventImported
untyped stringEventImported is a v1 record copied in; EventNotImported one left on v1, a shot of it finer than v2 takes (validShot): its ghost would not replay here.
Value
"Imported"
EventNotImported
untyped stringEventImported is a v1 record copied in; EventNotImported one left on v1, a shot of it finer than v2 takes (validShot): its ghost would not replay here.
Value
"NotImported"
ImportHole
func(id string) stringImportHole copies v1's current version of a course slot, by its id ("garden/7/v3"): its data, provenance (by, height, note), plays and wear. Only the owner can, into a slot v2 has nothing in yet.
- OID
- 07fad8…0765:159
ImportHole details
importHoleNow
func(id string) string- OID
- 07fad8…0765:161
importHoleNow details
importHole
func(id string, key string, hexData string, ver string, row string, state string) stringimportHole keeps the version id of slot key as v1 lists it: its data (hex), its row of Versions (ver), of Holes (row) and its HoleState (state).
- OID
- 07fad8…0765:162
importHole details
ImportRecord
func(hole string, mode string, player .uverse.address) boolImportRecord copies a player's v1 best on an imported hole in a mode (v1's Ghost: strokes, height, period, shots) and seats it as a finish would, onto the hole imported from v1 (the same data: its sha is v1's). Only the owner can, as the migration's script runs it: v1 plays on, with no near-copy rule, so a round played there later is not one to rank here. Idempotent: a record already as good stays; a better v1 one takes its place. A record with a shot finer than 0.01 (never one the game sends) stays on v1. It answers whether it copied anything.
- OID
- 07fad8…0765:163
ImportRecord details
importRecordNow
func(hole string, mode string, player .uverse.address) bool- OID
- 07fad8…0765:164
importRecordNow details
importRecord
func(e *v2.entry, m int, p string, g string, at int64) boolimportRecord copies p's best on e in mode m as v1's Ghost (g) has it; at is v1's standing's height (the course ranking's tie-break: the finish that last improved it, perhaps on a version since archived), 0 for none.
- OID
- 07fad8…0765:165
importRecord details
jobject
func(j string, id string) stringjobject is a v1 list from the object whose "id" is id on ("" if none): jget then reads that object's fields, which every object of the list has.
- OID
- 07fad8…0765:166
jobject details
jget
func(j string, k string) stringjget is a field of v1's JSON, as v1 writes it (jstr): a string's value, unescaped, or a number's or an array's inside, "" if absent.
- OID
- 07fad8…0765:167
jget details
view
typeThe data lives in store (the realm apart from these rules: a new version of the rules takes it on). A view is the rows of one of its collections under a prefix, read straight from store and written through this transaction's writes: queued as the call goes, read back by Get and Has, and sent to store in one batch as the entrypoint returns (flush). Iterate and ReverseIterate merge this call's writes into store's rows as they come; Size, index and IterateByOffset, a page by place, read store as it stands, so one over rows this call has written to panics instead (only the reads take them, which write nothing).
Value
v2.view
queued
[]string// set/del ops, four strings each, in order
Value
<zero>
over
map[string]string// collection + "\\x00" + key -> its value now; "\\x00" for removed
Value
<zero>
dirty
map[string]bool// the collections written to
Value
<zero>
seen
map[string]*v2.entry// the versions found in this call that writes: one object each (find)
Value
<zero>
begin
func()begin opens a call that writes: every crossing entrypoint that writes starts with it and ends with flush.
- OID
- 07fad8…0765:172
begin details
gone
untyped stringValue
"\x00"
queue
func(op string, c string, k string, x string)- OID
- 07fad8…0765:174
queue details
flush
func()flush sends this call's writes to store, in batches of what store takes in one call: every crossing entrypoint that writes ends with it, once it went through (begin opens it).
- OID
- 07fad8…0765:175
flush details
sortKeys
func(ks []string, back bool)sortKeys sorts keys ascending, or descending for back (a handful: insertion sort).
- OID
- 07fad8…0765:176
sortKeys details
firstRead
untyped bigintA page of store: the first a walk asks for, and the largest.
Value
(8 <untyped> bigint)
maxRead
untyped bigintA page of store: the first a walk asks for, and the largest.
Value
(300 <untyped> bigint)
nextRow
func(page string) (string, string, string)nextRow is a page's first row (store.Page: each length, ":", itself) and the rest.
- OID
- 07fad8…0765:177
nextRow details
field
func(s string) (string, string)- OID
- 07fad8…0765:178
field details
owner
.uverse.addressValue
<gnolang.StringValue>
pending
.uverse.addressValue
<zero>
self
stringself is golf's own pkgpath, hub its gnoweb path: every link follows from them, so the same code serves under any namespace.
Value
"gno.land/r/nym-alexiscolin000/gnogolf/golf/v2"
hub
stringself is golf's own pkgpath, hub its gnoweb path: every link follows from them, so the same code serves under any namespace.
Value
"/r/nym-alexiscolin000/gnogolf/golf/v2"
officialPrefix
string// the namespace's realms, as "…/" (these rules are …/golf/v2)
Value
"gno.land/r/nym-alexiscolin000/gnogolf/"
dataRealm
string// where the records are kept (kv.gno)
Value
"gno.land/r/nym-alexiscolin000/gnogolf/store"
playURL
stringplayURL is the 3D client every page links to (SetPlayURL moves it).
Value
"https://gnogolf.xyz/"
successor
stringsuccessor is the realm that took this course over, "" until the owner names it, once (SetSuccessor).
Value
""
init.211
func()- OID
- 07fad8…0765:187
init.211 details
setUp
func(deployer .uverse.address, chainID string)setUp is init: the deployer owns the course, and community publishing starts closed. Only \`gno test\` (chain "dev") runs it with no signer: the owner stays "", which holds no power, and publishing starts open, since nobody there could open it.
- OID
- 07fad8…0765:189
setUp details
Owner
func() .uverse.address- OID
- 07fad8…0765:190
Owner details
Pending
func() .uverse.address- OID
- 07fad8…0765:191
Pending details
Successor
func() stringSuccessor is the realm that took this course over, "" if none.
- OID
- 07fad8…0765:192
Successor details
isOwner
func(caller .uverse.address) boolisOwner is the one owner check: a live role, held by the caller.
- OID
- 07fad8…0765:193
isOwner details
Transfer
func(to .uverse.address)Transfer offers the role to another address, which takes it with Accept. Offering it to the owner themselves cancels an offer.
- OID
- 07fad8…0765:194
Transfer details
Accept
func()Accept takes the role a Transfer offered the caller.
- OID
- 07fad8…0765:195
Accept details
Renounce
func()Renounce gives the role up for good: no owner, no offer, and none possible.
- OID
- 07fad8…0765:196
Renounce details
maxURL
untyped bigintmaxURL bounds the play link, maxPkgPath a successor's pkgpath.
Value
(100 <untyped> bigint)
maxPkgPath
untyped bigintmaxURL bounds the play link, maxPkgPath a successor's pkgpath.
Value
(100 <untyped> bigint)
SetPlayURL
func(url string)SetPlayURL moves the link every page gives to the 3D client. Only the owner can. url is https://, at most 100 of letters, digits and "-.\_~/:%", with no query or fragment: a hole's link adds "?cup=…&hole=…" to it.
- OID
- 07fad8…0765:197
SetPlayURL details
validURL
func(u string) bool- OID
- 07fad8…0765:198
validURL details
SetSuccessor
func(pkgpath string)SetSuccessor names the realm that takes this course over, once and for good: a pkgpath under gno.land/r/, not golf itself, with no "", "." or ".." segment. Only the owner can. It moves and blocks nothing: the pages and Holes say where the course went, and play goes on here. golf does not check the realm exists: check the path before sending.
- OID
- 07fad8…0765:199
SetSuccessor details
Hide
func(slot string, hide bool)Hide takes a community hole ("\<address>/\<slug>", every version) off the lists (the hub, Holes, the 3D game), for a scam or abuse in its name or note; hide=false puts it back. Only the owner can. Its data, rounds and page stay, Community still has it, and a new version stays hidden. A hole already as asked is left alone, with no event.
- OID
- 07fad8…0765:200
Hide details
hideNow
func(slot string, hide bool)- OID
- 07fad8…0765:201
hideNow details
publishing
boolpublishing is whether anyone can publish a community hole (PublishMine): closed at deploy (setUp), opened later without a redeploy.
Value
false
Publishing
func() boolPublishing is whether PublishMine is open.
- OID
- 07fad8…0765:203
Publishing details
SetPublishing
func(open bool)SetPublishing opens community publishing (PublishMine) or closes it again. Only the owner can. Closing stops new holes and versions only: every hole published stays playable and listed. Setting it as it is does nothing.
- OID
- 07fad8…0765:204
SetPublishing details
validPkgPath
func(p string) bool- OID
- 07fad8…0765:205
validPkgPath details
EventHolePublished
untyped string// hole, slot, sha, by, official ("true"/"false")
Value
"HolePublished"
EventHoleRetired
untyped string// hole, next
Value
"HoleRetired"
EventShot
untyped string// hole, player, strokes, mode, shot ("angle,power,tick" as recorded)
Value
"Shot"
EventHoled
untyped string// hole, player, strokes, mode, shots (the round's)
Value
"Holed"
EventCopyNotRanked
untyped string// hole, player, mode: a record sent again, kept, not ranked
Value
"CopyNotRanked"
EventRoundReset
untyped string// hole, player
Value
"RoundReset"
EventOwnershipOffered
untyped string// owner, to
Value
"OwnershipOffered"
EventOwnershipOfferCancelled
untyped string// owner
Value
"OwnershipOfferCancelled"
EventOwnershipTransfer
untyped string// from, to
Value
"OwnershipTransfer"
EventOwnershipRenounced
untyped string// from
Value
"OwnershipRenounced"
EventPlayURLSet
untyped string// url
Value
"PlayURLSet"
EventSuccessorSet
untyped string// successor
Value
"SuccessorSet"
EventPublishingSet
untyped string// open ("true"/"false")
Value
"PublishingSet"
wearRunes
untyped string// pristine grass blank: a shot's dots stand out on it
Value
" :;x%"
wearLight
untyped bigintwearRunes draw a cell's wear: none, then up to wearLight, wearWorn and wearGroove balls come to rest there, and past.
Value
(2 <untyped> bigint)
wearWorn
untyped bigintwearRunes draw a cell's wear: none, then up to wearLight, wearWorn and wearGroove balls come to rest there, and past.
Value
(6 <untyped> bigint)
wearGroove
untyped bigintwearRunes draw a cell's wear: none, then up to wearLight, wearWorn and wearGroove balls come to rest there, and past.
Value
(14 <untyped> bigint)
maxTunnels
untyped bigintmaxTunnels is how many tunnels the board numbers, 1 to 9.
Value
(9 <untyped> bigint)
markWall
runeValue
35
markPost
runeValue
48
markCup
rune// not O: in gnoweb's font O and the post's 0 look alike
Value
85
markTee
runeValue
42
Render
func(path string) stringRender is the game as text: gnoweb draws the board and submits the shot. Paths: "" the hub; "\<world>" a cup's holes; "\<address>" the holes an address published; "\<hole>" a hole's page, "\<hole>/\<address>" the same with that player's ball, "\<hole>/data" a version's provenance and data. \<hole> is a version's id or an alias. A query string ("?…") is ignored.
- OID
- 07fad8…0765:206
Render details
noSuch
func(path string) stringnoSuch is the page for a path that is no hole, cup or address.
- OID
- 07fad8…0765:208
noSuch details
lookup
func(id string) *v2.entrylookup is readHole that answers nil for no hole.
- OID
- 07fad8…0765:209
lookup details
playLink
func(e *v2.entry) stringplayLink is the 3D client's link to this hole: a current course hole by cup and order, any other by its id, which no newer version can take.
- OID
- 07fad8…0765:210
playLink details
cupName
func(w string) stringcupName is how a world is called on the page.
- OID
- 07fad8…0765:211
cupName details
who
func(addr string) stringwho is a player as a link to their gno.land profile.
- OID
- 07fad8…0765:212
who details
renderHub
func() string- OID
- 07fad8…0765:213
renderHub details
fairPlay
func() stringfairPlay says what keeps a score honest, and where the rules stand.
- OID
- 07fad8…0765:214
fairPlay details
moved
func() stringmoved is the banner every page shows once these rules no longer save (the data's writer is another, or saves are paused) or the course has moved.
- OID
- 07fad8…0765:215
moved details
renderCup
func(world string) stringrenderCup is a cup's page: its current holes, in order.
- OID
- 07fad8…0765:216
renderCup details
renderAuthor
func(a .uverse.address) stringrenderAuthor is the holes an address published, as their current versions.
- OID
- 07fad8…0765:217
renderAuthor details
bestCell
func(e *v2.entry, names map[string]string) stringbestCell is a hole's records, assisted then pro, for a table cell. names caches holders: r/sys/users is read once a player, not once a record.
- OID
- 07fad8…0765:218
bestCell details
weatherNote
func(f course.Forecast) stringweatherNote is the hole's weather now (f, the forecast of this period) and how long it lasts, on a hole's own page.
- OID
- 07fad8…0765:219
weatherNote details
noAdmin
func() stringnoAdmin states who can change what, the owner's own powers included.
- OID
- 07fad8…0765:220
noAdmin details
source
func(e *v2.entry) stringsource links a hole's data page: read it before trusting it with a round.
- OID
- 07fad8…0765:221
source details
md
func(label string, href string) string- OID
- 07fad8…0765:222
md details
vsPar
func(d int) stringvsPar is a score against par: "even", "+3", "-2" (ufmt has no %+d).
- OID
- 07fad8…0765:223
vsPar details
flatRolls
untyped stringflatRolls is how far a shot rolls on flat grass (a tee shot's Kick, the usual friction).
Value
"On flat grass a power of 10 rolls about 40, a 5 about 15."
renderHole
func(e *v2.entry, h *course.Simple, focus .uverse.address) string- OID
- 07fad8…0765:224
renderHole details
roundSummary
func(e *v2.entry, p .uverse.address, r *v2.round) stringroundSummary is how a player stands on the hole: their round under way, if any, and their best in each mode, with where it puts them on the hole's board, or why nowhere. A holed round is not kept: its best is.
- OID
- 07fad8…0765:225
roundSummary details
shotsOf
func(shots string) stringshotsOf is a round's shots for a page: golf's own "%.4f,%.4f,%d", digits and punctuation only.
- OID
- 07fad8…0765:226
shotsOf details
renderData
func(e *v2.entry) stringrenderData is a data version's page: where it came from, its versions, and its data, which is all the hole there is.
- OID
- 07fad8…0765:227
renderData details
board
func(e *v2.entry, h *course.Simple, f *physics.Field, mine *v2.round, now course.Forecast) stringboard is the version's board in mode m: boardKey(best, player) -> player, the named players' bests, fewest strokes first.
- OID
- 07fad8…0765:228
board details
drawZone
func(g [][]int32, z *physics.Zone, m int32)drawZone marks the cells whose centre the zone holds, as the physics sees it (physics.Zone.Contains): a polygon's row from where the centre line crosses its edges, an ellipse's as the run the physics' test finds from its middle.
- OID
- 07fad8…0765:229
drawZone details
boxCells
func(lo float64, hi float64, n int) (int, int)boxCells is the cells from int(lo) to int(hi), within 0..n, whose centre lies in \[lo, hi): the cells the physics' box test takes.
- OID
- 07fad8…0765:230
boxCells details
cellAt
func(c float64, lo int, hi int) intcellAt is the first cell in \[lo, hi), lo >= 0, whose centre is at or past c (!(x+0.5 \< c), as the physics compares), hi if none: ceil(c-0.5).
- OID
- 07fad8…0765:231
cellAt details
firstCell
func(lo int, hi int, ok func(...)) intfirstCell is the first x in \[lo, hi) where ok turns true, hi if it never does: ok is false up to some x, and true from there.
- OID
- 07fad8…0765:232
firstCell details
fillRow
func(row []int32, from int, to int, m int32)- OID
- 07fad8…0765:233
fillRow details
span
func(lo float64, hi float64, n int) (int, int)span is the cells from int(lo) to int(hi), within 0..n.
- OID
- 07fad8…0765:234
span details
maxBoardWork
untyped bigintmaxBoardWork bounds a board's drawing, in thousands of gas (boardWork): past it the page does not draw, far under the 3e9 a query may use.
Value
(600000 <untyped> bigint)
boardWork
func(f *physics.Field, h *course.Simple) intboardWork estimates board's cost in thousands of gas, with measured weights: a board cell; a cell and a polygon edge per row of a zone's box (every edge counted as crossing, as a zigzag's do); a step along a wall; a cell of a post's box.
- OID
- 07fad8…0765:235
boardWork details
key
func(b string, walls string) stringkey names the board's fixed marks it shows (tee and cup always), with the skins of the walls drawn \`#\`.
- OID
- 07fad8…0765:236
key details
legend
func(f *physics.Field) (string, string)legend names the pieces the hole gave a skin (a slope with the way it falls), and the skins of its \`#\` walls.
- OID
- 07fad8…0765:237
legend details
mark
func(m int32, def int32) int32mark counts a ball come to rest in wear cell i.
- OID
- 07fad8…0765:238
mark details
wearRune
func(wear []int, x int, y int) int32wearRune takes wear-cell coordinates.
- OID
- 07fad8…0765:239
wearRune details
trace
func(g [][]int32, s physics.Segment, c int32)trace draws a wall as points every half unit, put inlined: a board has thousands.
- OID
- 07fad8…0765:240
trace details
fill
func(g [][]int32, c physics.Circle, r int32)fill draws a post: the cells whose centre is within its radius. LenCmp skips Len's software square root.
- OID
- 07fad8…0765:241
fill details
put
func(g [][]int32, p physics.Vec2, c int32)- OID
- 07fad8…0765:242
put details
short
func(addr string) string- OID
- 07fad8…0765:243
short details
blankUnreachable
func(g [][]int32, wall [][]int32, f *physics.Field, seeds []physics.Vec2)blankUnreachable clears the cells no ball can reach: a flood fill from the tee, the cup and where tunnels and hazards put the ball, stopped by walls.
- OID
- 07fad8…0765:244
blankUnreachable details
race
func(e *v2.entry, p string, label string) stringrace is the 3D game's dare link (by=): this hole against p's best's ghost.
- OID
- 07fad8…0765:245
race details
byName
func(addr string) stringbyName is a player by their gno.land name when they have one.
- OID
- 07fad8…0765:246
byName details
count
func(n int, what string) stringcount is n things, said right for one.
- OID
- 07fad8…0765:247
count details
HoleState
func(hole string) stringHoleState is the hole as JSON for a client: geometry, skins (names the client looks up), weather and wear, all it needs to draw the hole and aim. hole is a version's id or an alias; "hole" in the answer is always the version's id, the one to write with, with its "slot" and "v", and an archived one's "next". A shot's path (Round, Simulate\*) is the flight the chain computed: replay it, never re-simulate. Points far apart are a tunnel: do not interpolate.
- OID
- 07fad8…0765:248
HoleState details
roundJSON
func(e *v2.entry, h *course.Simple, player string, r *v2.round) stringroundJSON is one player's round: ball rounded, rest exact (for SimulateFrom) and the last stroke replayed: rounds store shots, not paths.
- OID
- 07fad8…0765:250
roundJSON details
lastShot
func(h *course.Simple, r *v2.round, fc course.Forecast) physics.ShotlastShot replays a round's last stroke, read-only, with its stroke number, tick and weather (fc, its period's forecast): the same flight, less the wear. Empty before a first one.
- OID
- 07fad8…0765:251
lastShot details
pathJSON
func(ps []physics.Vec2) stringpathJSON is a shot's path points, comma separated.
- OID
- 07fad8…0765:252
pathJSON details
airOf
func(s physics.Shot) stringairOf is a shot's air flags, one character per path point: "0001100…".
- OID
- 07fad8…0765:253
airOf details
Round
func(hole string, player .uverse.address) stringRound is one player's round under way on a hole with its last stroke's path, or null if they have none: never started, holed (its best is kept: Ghost) or Reset. It costs one stroke of gas.
- OID
- 07fad8…0765:254
Round details
sep
func(i int) string- OID
- 07fad8…0765:255
sep details
jnum
func(v float64) stringjnum is a number with 3 decimals, the bytes of ufmt's "%.3f" at a fraction of its gas. NaN and Inf, not JSON, print 0. Below 1e12, v\*1000 is within 1.2e-4 of the exact decimal, so its integer part decides the rounding unless the fraction is within 1e-3 of a half: those, and huge numbers, go to strconv, which is exact.
- OID
- 07fad8…0765:256
jnum details
jexact
func(v physics.Vec2) stringjexact is a point exactly, as the shortest decimals that read back as the same float64: what a client hands back to SimulateFrom.
- OID
- 07fad8…0765:257
jexact details
versionJSON
untyped stringversionJSON opens every object a read returns.
Value
"\"version\":1"
jvec
func(v physics.Vec2) string- OID
- 07fad8…0765:258
jvec details
jstr
func(s string) stringjstr quotes an author's string so it cannot break out of its JSON. Every byte below 0x20 is escaped: one in one hole's name would make Holes() invalid JSON for every client. Most strings need nothing escaped: they go out as they are, without the copy (a byte at a time costs gas).
- OID
- 07fad8…0765:259
jstr details
jid
func(s string) stringjid quotes a version's id or alias, which golf builds of nothing to escape (a world and order, or an address and a slug: validSlug): not scanned.
- OID
- 07fad8…0765:260
jid details
jescape
func(s string) string- OID
- 07fad8…0765:261
jescape details
Holes
func() stringHoles lists at most maxListed holes for a client's menu, as listed orders them: the course's current holes, its latest archived versions, then community holes, newest first, perAuthor an address, none hidden (the rest are in Community). official marks the course's holes, the only ones in a cup and the course ranking; next is the version that replaced a hole, slot its alias, play the 3D client's link, successor the realm that took the course over ("" if none). It decodes nothing.
- OID
- 07fad8…0765:262
Holes details
holeRow
func(e *v2.entry) stringholeRow is one hole as Holes and Community list it.
- OID
- 07fad8…0765:263
holeRow details
Community
func(after string, limit int) stringCommunity is a page of every community hole, every version of each, by id: all that Holes leaves out. It is paged like Records.
- OID
- 07fad8…0765:264
Community details
perAuthor
untyped bigintperAuthor is the most published holes of one address Holes and the hub list: one address publishing a hundred cannot push everyone else's out.
Value
(3 <untyped> bigint)
listed
func() []*v2.entrylisted is the holes in list order, at most maxListed: every current course hole in course order; then, if minCommunity places stay free, up to maxArchived archived course versions, latest archived first; then, in the room left, the newest shown community holes (current, not hidden) among each author's perAuthor newest, by block height then alias, last first. An author fills perAuthor rows at most, however many holes they publish. It reads about what it lists: authors latest first, perAuthor keys each, until an author's latest is older than every row kept (room+1 authors at most). Hidden holes have no byAuthor row: nothing hidden is walked.
- OID
- 07fad8…0765:265
listed details
authorRows
untyped stringauthorRows is past the last of byAuthor's author rows ("\<height> \<address>") and before its first hole ("g1…"): no key is ":".
Value
":"
maxArchived
untyped bigintmaxArchived bounds the archived course versions Holes and the hub list, and minCommunity is the room they leave for community holes.
Value
(20 <untyped> bigint)
minCommunity
untyped bigintmaxArchived bounds the archived course versions Holes and the hub list, and minCommunity is the room they leave for community holes.
Value
(20 <untyped> bigint)
SimulateFrom
func(hole string, ballX float64, ballY float64, shot string, stroke int, period int64) stringSimulateFrom previews one shot, read-only: from an exact ball (a "rest" answered before), shot "angle,power,tick", its stroke number (0 is the first; timed and pulse holes change with it) and any period not ahead. It is what PlayRoundAt would play, for one shot's gas. As a vm/qeval query it needs no transaction or wallet: a client animates a shot the instant it is released.
- OID
- 07fad8…0765:266
SimulateFrom details
validStroke
func(stroke int)- OID
- 07fad8…0765:267
validStroke details
onBoard
func(h *course.Simple, x float64, y float64) physics.Vec2onBoard refuses a ball off the board (or NaN): no round leaves one there.
- OID
- 07fad8…0765:268
onBoard details
shotJSON
func(shot physics.Shot) stringshotJSON is a shot's path, air, cause, work (Shot.Work, which a client adds up as a commit does) and exact resting point.
- OID
- 07fad8…0765:269
shotJSON details
SimulateRound
func(hole string, shots string) stringSimulateRound replays a shot list from the tee, read-only, and returns its last shot and stroke count: what PlayRound would record, refusals included. Continue from an exact "rest" (SimulateFrom): rounded points are for drawing.
- OID
- 07fad8…0765:270
SimulateRound details
SimulateRoundAt
func(hole string, shots string, period int64) stringSimulateRoundAt is SimulateRound in a period's weather, the current one or the one before, as a round's first stroke: it agrees with PlayRoundAt.
- OID
- 07fad8…0765:271
SimulateRoundAt details
SimulateRoundIn
func(hole string, shots string, period int64) stringSimulateRoundIn is SimulateRound in any period gone by, to check a recorded round as the chain played it. Weather still to come is refused.
- OID
- 07fad8…0765:272
SimulateRoundIn details
SimulateCommit
func(hole string, ballX float64, ballY float64, stroke int, shots string, period int64) stringSimulateCommit previews the next PlayRoundAt (or PlayRoundPro) commit, read-only: shots from the exact ball ("rest") at stroke number stroke (0 is the first) in period's weather. It refuses what that commit would (too much work, too many strokes, a weather over), so a client checks every commit before it signs any. JSON as SimulateRound; strokes counts after the commit.
- OID
- 07fad8…0765:273
SimulateCommit details
simulateRound
func(hole string, from *physics.Vec2, strokes int, shots string, period int64) stringsimulateRound is the SimulateRound\* and SimulateCommit replay: from nil is the tee, and the first shot is stroke number strokes.
- OID
- 07fad8…0765:274
simulateRound details
boardJSON
func(h *course.Simple) string- OID
- 07fad8…0765:275
boardJSON details
wallsJSON
func(ws []physics.Wall) string- OID
- 07fad8…0765:276
wallsJSON details
postsJSON
func(ps []physics.Post) string- OID
- 07fad8…0765:277
postsJSON details
zonesJSON
func(zs []physics.Zone, flags bool) stringzonesJSON is a hole's zones, or the weather's (forecastJSON: no flags). With flags, "air" and "capped" are printed only when true.
- OID
- 07fad8…0765:278
zonesJSON details
timingJSON
func(every int, on int, phase int) stringtimingJSON is a timed piece's clock (a tram, a storm's gusts); nothing for an untimed one.
- OID
- 07fad8…0765:279
timingJSON details
polyJSON
func(z *physics.Zone) stringpolyJSON is a polygon zone's outline, and whether it is the outside of it; nothing for the usual rectangle or ellipse.
- OID
- 07fad8…0765:280
polyJSON details
Extras
func(hole string, stroke int) stringExtras is what a timed hole adds at one stroke of a round (0 is the first), to draw over HoleState's field. Empty for other holes.
- OID
- 07fad8…0765:281
Extras details
Leaderboard
func(mode string) stringLeaderboard is a mode's course-wide top ten ("assisted" or "pro"): named players' bests on the current course holes, summed; most holes, then the best score against par (strokes - par), then the first there. Its cost does not grow with players.
- OID
- 07fad8…0765:282
Leaderboard details
eachRanked
func(m int, fn func(...))eachRanked walks a mode's top ten: the first named players of its ranking, with their names. A name deleted since is skipped, not shown.
- OID
- 07fad8…0765:283
eachRanked details
maxWalked
untyped bigintmaxWalked is the most rows a top ten walks, skipped names included.
Value
(40 <untyped> bigint)
strokesRow
func(p string, name string, strokes int) stringstrokesRow and standingRow are a player's best or standing row; name is "" on the reads that resolve no names. A standing's par is its holes' pars summed: strokes - par is its score against par.
- OID
- 07fad8…0765:284
strokesRow details
standingRow
func(p string, name string, r *v2.row) string- OID
- 07fad8…0765:285
standingRow details
standingFields
func(r *v2.row) stringstandingFields is a standing's numbers: holes, strokes and par.
- OID
- 07fad8…0765:286
standingFields details
nameField
func(name string) string- OID
- 07fad8…0765:287
nameField details
Rank
func(mode string, player .uverse.address) stringRank is a player's place in a mode's course ranking, with their standing: "rank" 1 is the top, out of "of"; 0 if unnamed or no current course hole finished. A name deleted since keeps its place until its next change, so a rank may be that many too low.
- OID
- 07fad8…0765:288
Rank details
CourseLeaderboard
func(mode string, offset int, limit int) stringCourseLeaderboard is a page of a mode's course ranking, paged like HoleLeaderboard. holes is the course's current holes, players how many the ranking holds.
- OID
- 07fad8…0765:289
CourseLeaderboard details
Ghost
func(hole string, mode string, player .uverse.address) stringGhost is a player's best round on a hole in a mode, named or not, with its height (the first to a score ranks first), period and shots, or null: what a duel races. It replays in its own weather (SimulateRoundIn for the first stroke, then SimulateFrom from each rest).
- OID
- 07fad8…0765:290
Ghost details
HoleRank
func(hole string, mode string, player .uverse.address) stringHoleRank is a player's place on a hole's board in a mode, with their best, as Rank: 0 if unnamed or no finish there.
- OID
- 07fad8…0765:291
HoleRank details
maxListed
untyped bigintmaxListed bounds Holes() and the hub: anyone can add a hole.
Value
(120 <untyped> bigint)
HoleLeaderboard
func(hole string, mode string, offset int, limit int) stringHoleLeaderboard is a page of a hole's board in a mode: named players' bests, fewest strokes then first there, from rank offset+1 (clamped to 0..players), at most limit rows (1..100). players is the named players, finished anyone who finished; next is the next offset, 0 at the end. A name deleted since is skipped, so a page may hold fewer rows. A page reads its own rows only.
- OID
- 07fad8…0765:292
HoleLeaderboard details
pageMax
untyped bigintpageMax is the most rows one page of a read returns.
Value
(100 <untyped> bigint)
clampLimit
func(n int) intclampLimit keeps a page's size to 1..pageMax.
- OID
- 07fad8…0765:293
clampLimit details
maxFriends
untyped bigintmaxFriends bounds the addresses one Bests or Standings read takes.
Value
(50 <untyped> bigint)
friends
func(list string) []stringfriends splits a comma-separated list of addresses: each valid one once, at most maxFriends. Junk and repeats are skipped and use up nothing.
- OID
- 07fad8…0765:294
friends details
Bests
func(hole string, mode string, players string) stringBests is the best finished round on one hole, in a mode, of each of the given players (comma-separated addresses, named or not): a board of friends, where no stranger and no bot can push anyone off.
- OID
- 07fad8…0765:295
Bests details
Standings
func(mode string, players string) stringStandings is each given player's course-wide standing in a mode: how many of the course's current holes they finished, in how many strokes, and those holes' pars summed.
- OID
- 07fad8…0765:296
Standings details
Records
func(hole string, mode string, after string, limit int) stringRecords is a page of every player's best on a hole in a mode, named or not, with the height that ranks it before a later tie: all a successor needs to carry the boards over in their order. The paged reads (Records, Players, Community) walk everything by key: after is the last key of the page before ("" for the first), limit is clamped to 1..100, next is the after of the next page ("" at the end).
- OID
- 07fad8…0765:297
Records details
Players
func(mode string, after string, limit int) stringPlayers is a page of every course standing in a mode, named or not: its holes, strokes and par (all the ranking's key reads) and the height of the finish that last improved it (the tie-break), paged like Records.
- OID
- 07fad8…0765:298
Players details
walk
typewalk is a tree's Iterate: what page reads.
Value
v2.walk
rowOf
func(m int, p string) *v2.rowrowOf is a ranked player's course standing in mode m (a row that ranks has one).
- OID
- 07fad8…0765:299
rowOf details
page
func(t v2.walk, after string, limit int, fn func(...)) stringpage walks up to limit entries of t after the key after, and returns the key to continue from, "" at the end.
- OID
- 07fad8…0765:300
page details
PeriodSeconds
untyped bigintPeriodSeconds is how long one weather lasts.
Value
(300 <untyped> bigint)
Period
func() int64Period is the weather period of the chain's current block time.
- OID
- 07fad8…0765:301
Period details
weatherOf
func(e *v2.entry, h *course.Simple, period int64) course.ForecastweatherOf is the hole's weather in a period: seeded by its id, so each version of a slot has weather of its own.
- OID
- 07fad8…0765:303
weatherOf details
forecastJSON
func(head string, f course.Forecast) stringforecastJSON is a forecast as an object, head its first fields if any (as \`"version":1,\`). Zones' air and capped are not printed: only the wind has them, always.
- OID
- 07fad8…0765:304
forecastJSON details
Weather
func(hole string, period int64) stringWeather is a hole's weather in a period, as JSON: the zones a client draws and the chain plays under. Its "gas" is what a commit there spends before its first shot (decoding and forecast), counted against the commit's budget: a client adds it to its shots' estimate. A future period panics.
- OID
- 07fad8…0765:305
Weather details
notAhead
func(period int64)notAhead refuses a period still to come. It is no secret (ForecastFor is pure): this only keeps reads to the weather a round can be played in.
- OID
- 07fad8…0765:306
notAhead details
notOver
func(period int64)notOver refuses a round's weather two periods or more behind: a round left for later cannot be finished days on in the weather it picked.
- OID
- 07fad8…0765:307
notOver details
playablePeriod
func(period int64)playablePeriod checks the period a round starts under: the current one, or the one just gone, for a round that ran over the turn of the period.
- OID
- 07fad8…0765:308