tictactoe

package
v0.0.0-...-06b8776 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2017 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Sample tictactoe implements a tic-tac-toe game using Firebase as a communication mechanism.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Game

type Game struct {
	K            *datastore.Key `json:"-" datastore:"__key__"`
	UserX        string         `json:"userX"`
	UserO        string         `json:"userO"`
	Board        string         `json:"board"`
	MoveX        bool           `json:"moveX"`
	Winner       string         `json:"winner"`
	WinningBoard string         `json:"winningBoard"`
}

func NewGame

func NewGame() *Game

func (*Game) CheckWin

func (g *Game) CheckWin() (winner string, gameOver bool)

CheckWin returns "X" or "O", depending on who won. It will be empty if the game was a draw.

func (*Game) MoveAt

func (g *Game) MoveAt(index int) error

MoveAt plays a move at the specified index. Input is assumed to be valid.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL