Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

v0 state

Back to all declarations

Game

type

Game is a match between First and Second. First plays turn 1. It is pending until Second accepts, and only then are players named in events that notify them.

Value

v0.Game

lastGame

v0.ID

Value

<zero>

declared

bool

Value

true

NewGame

func(opponent .uverse.address) string

NewGame invites opponent to a game and returns its id. The caller plays first once opponent accepts.

Open
OID
07dd49…5ac2:9
NewGame details

Inspect func

Accept

func(game string)

Accept starts a pending game. Only the invited player may call it.

Open
OID
07dd49…5ac2:10
Accept details

Inspect func

Play

func(game string)

Play takes the caller's turn in game and passes it to the other player.

Open
OID
07dd49…5ac2:11
Play details

Inspect func

Leave

func(game string)

Leave cancels a pending game or ends a started one, and deletes it.

Open
OID
07dd49…5ac2:12
Leave details

Inspect func

DeclareTriggers

func()

DeclareTriggers declares the "your turn" trigger in the gnotif registry. The registry sees this realm as the caller, so the trigger is verified.

Open
OID
07dd49…5ac2:13
DeclareTriggers details

Inspect func

pageSize

untyped bigint

Value

(50 <untyped> bigint)

Render

func(path string) string

Render serves "" (the first page), "page/N" and "game/\<id>".

Open
OID
07dd49…5ac2:14
Render details

Inspect func

renderPage

func(n int) string

renderPage lists the games newest first, pageSize to a page.

Open
OID
07dd49…5ac2:16
renderPage details

Inspect func

renderGame

func(g *v0.Game) string
Open
OID
07dd49…5ac2:17
renderGame details

Inspect func

selfPath

string

selfPath is this realm's path on gnoweb. It is read at package init, where the realm itself is current; Render is not crossing, so reading it there would give the caller's path. It only builds links.

Value

"/r/g13rqvks880v0hmlfepcj0kkudq0js38d3pc5k6a/pingpong/v0"
Game : type =v0.Game
games : v0.Tree Inspect
lastGame : v0.ID =<zero>
declared : bool =true
load : func(id string) *v0.Game Inspect
NewGame : func(opponent .uverse.address) string Inspect
Accept : func(game string) Inspect
Play : func(game string) Inspect
Leave : func(game string) Inspect
DeclareTriggers : func() Inspect
pageSize : untyped bigint =(50 <untyped> bigint)
Render : func(path string) string Inspect
renderPage : func(n int) string Inspect
renderGame : func(g *v0.Game) string Inspect
status : func(g *v0.Game) string Inspect
selfPath : string ="/r/g13rqvks880v0hmlfepcj0kkudq0js38d3pc5k6a/pingpong/v0"