game

package
v0.0.0-...-713b49f Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2015 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package game keeps track of basic poker game information. Any Player may use the game.Play function in order to play a game.

Index

Constants

View Source
const (
	PreFlop = iota
	Flop
	Turn
	River
	Showdown
)

Variables

This section is empty.

Functions

func Play

func Play(rules string, p Player, host, port string)

Start playing a game.

rules -- a String naming the game to play
p     -- an object that implements the Player interface.
host  -- the InetAddress of the dealer passed as a String
port  -- the port the dealer is listening on for the client passed as a String

Types

type Game

type Game struct {
	Round   int          // 0-4: pre-flop, flop, turn, river, showdown.
	Bets    [4][]float64 // The chips put in for each player for each round.
	Holes   []string     // All of the viewable hole cards.
	Board   []string     // All of the board cards.
	Raises  int          // The number of raises this round.
	Actions []byte       // The last action taken by each player.
	Actor   int          // The player whose turn it is to act.
	*Rules               // The set of rules to use to play the game.
	Event   interface{}  // The most recent event
	*diff.Players
}

func NewGame

func NewGame(rules string) (*Game, error)

func (*Game) CallAmt

func (this *Game) CallAmt() float64

func (*Game) Copy

func (this *Game) Copy() *Game

Makes a partial copy of the Game that is specifically suited for creating game trees.

func (*Game) LegalActions

func (this *Game) LegalActions() string

LegalActions returns a string containing the currently legal actions.

func (*Game) NumActive

func (this *Game) NumActive() int

NumActive returns how many players are still in the hand.

func (*Game) Pot

func (this *Game) Pot() float64

func (*Game) RaiseAmt

func (this *Game) RaiseAmt() float64

func (*Game) String

func (this *Game) String() string

func (*Game) Update

func (this *Game) Update(event interface{})

type Player

type Player interface {
	Play(g *Game) (action string)
	Observe(g *Game)
}

type Rules

type Rules struct {
	// contains filtered or unexported fields
}

func ChooseRules

func ChooseRules(rules string) (*Rules, error)

Directories

Path Synopsis
Package diff provides the Diff engine for updating a game.
Package diff provides the Diff engine for updating a game.

Jump to

Keyboard shortcuts

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