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