Documentation ¶
Index ¶
- type FieldValue
- type TicTacToeApp
- func (a *TicTacToeApp) Def() wallet.Address
- func (a *TicTacToeApp) InitData(firstActor channel.Index) *TicTacToeAppData
- func (a *TicTacToeApp) NewData() channel.Data
- func (*TicTacToeApp) Set(s *channel.State, x, y int, actorIdx channel.Index) error
- func (a *TicTacToeApp) ValidInit(p *channel.Params, s *channel.State) error
- func (a *TicTacToeApp) ValidTransition(params *channel.Params, from, to *channel.State, actor channel.Index) error
- type TicTacToeAppData
- func (d TicTacToeAppData) CheckFinal() (isFinal bool, winner *channel.Index)
- func (d *TicTacToeAppData) Clone() channel.Data
- func (d *TicTacToeAppData) MarshalBinary() ([]byte, error)
- func (d *TicTacToeAppData) Set(row, col int, actorIdx channel.Index) error
- func (d *TicTacToeAppData) String() string
- func (d *TicTacToeAppData) UnmarshalBinary(data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FieldValue ¶
type FieldValue uint8
func (FieldValue) PlayerIndex ¶
func (v FieldValue) PlayerIndex() channel.Index
func (FieldValue) String ¶
func (v FieldValue) String() string
type TicTacToeApp ¶
TicTacToeApp is a channel app.
func NewTicTacToeApp ¶
func NewTicTacToeApp(addr wallet.Address) *TicTacToeApp
func (*TicTacToeApp) InitData ¶
func (a *TicTacToeApp) InitData(firstActor channel.Index) *TicTacToeAppData
func (*TicTacToeApp) NewData ¶
func (a *TicTacToeApp) NewData() channel.Data
func (*TicTacToeApp) ValidTransition ¶
func (a *TicTacToeApp) ValidTransition(params *channel.Params, from, to *channel.State, actor channel.Index) error
ValidTransition is called whenever the channel state transitions.
type TicTacToeAppData ¶
type TicTacToeAppData struct { NextActor uint8 Grid [9]FieldValue }
TicTacToeAppData is the app data struct. Grid: 0 1 2 3 4 5 6 7 8
func (TicTacToeAppData) CheckFinal ¶
func (d TicTacToeAppData) CheckFinal() (isFinal bool, winner *channel.Index)
func (*TicTacToeAppData) Clone ¶
func (d *TicTacToeAppData) Clone() channel.Data
Clone returns a deep copy of the app data.
func (*TicTacToeAppData) MarshalBinary ¶
func (d *TicTacToeAppData) MarshalBinary() ([]byte, error)
MarshalBinary encodes the data to bytes.
func (*TicTacToeAppData) Set ¶
func (d *TicTacToeAppData) Set(row, col int, actorIdx channel.Index) error
func (*TicTacToeAppData) String ¶
func (d *TicTacToeAppData) String() string
func (*TicTacToeAppData) UnmarshalBinary ¶
func (d *TicTacToeAppData) UnmarshalBinary(data []byte) error
UnmarshalBinary decodes channel data from bytes.
Click to show internal directories.
Click to hide internal directories.