Tic-tac-toe: Difference between revisions

→‎{{header|Racket}}: be more specific about the generality of game.rkt
(→‎{{header|Ruby}}: add ! to method name with side effects; move a blank line)
(→‎{{header|Racket}}: be more specific about the generality of game.rkt)
Line 4,506:
V
+ game.rkt -- Written in Lazy Racket, defines general classes for the game and players.
| Knows nothing about tick-tack-toe, oronly anyabout otherzero-sum particular game.two-player
| turn-taking games with perfect information in general.
V
+ tick-tack.rkt -- Written in Racket, implements the tick-tack-toe game.
Line 4,565 ⟶ 4,566:
;; optimal-move :: State -> Move
;; Choses the optimal move.
;; If several equipollentequivalent moves exist -- choses one randomly.
(define/public ((optimal-move look-ahead) S)
(! (argmax (λ (m) (! (minimax (game-tree S m look-ahead))))
21

edits