From c2b87ce0079a1981f01243886ff01cbc4b3e784d Mon Sep 17 00:00:00 2001 From: John DeNero Date: Tue, 3 Jan 2012 12:15:08 +1100 Subject: [PATCH] doc/codewalk/functions.xml: Fix broken function examples I removed the broken function comparison example and fixed a code highlighting regexp. R=golang-dev, adg CC=golang-dev https://golang.org/cl/5501078 --- doc/codewalk/functions.xml | 12 +----------- doc/codewalk/pig.go | 3 --- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/doc/codewalk/functions.xml b/doc/codewalk/functions.xml index 986a017e1a5..db518dcc06c 100644 --- a/doc/codewalk/functions.xml +++ b/doc/codewalk/functions.xml @@ -45,7 +45,7 @@ turn. - + Go functions can return multiple values.

@@ -82,16 +82,6 @@ associated with the current player.
- - Functions can be compared for equality in Go. From the - language specification: - Function values are equal if they refer to the same function or if both are nil. -

- - We enforce that a strategy function can only return a legal - action: either roll or stay. -
- The roundRobin function simulates a tournament and tallies wins. Each strategy plays each other strategy gamesPerSeries times. diff --git a/doc/codewalk/pig.go b/doc/codewalk/pig.go index b3f02aff1e0..10963b4e405 100644 --- a/doc/codewalk/pig.go +++ b/doc/codewalk/pig.go @@ -61,9 +61,6 @@ func play(strategy0, strategy1 strategy) int { currentPlayer := rand.Intn(2) // Randomly decide who plays first for s.player+s.thisTurn < win { action := strategies[currentPlayer](s) - if action != roll && action != stay { - panic(fmt.Sprintf("Player %d is cheating", currentPlayer)) - } s, turnIsOver = action(s) if turnIsOver { currentPlayer = (currentPlayer + 1) % 2