Learn R Programming

rt3 (version 0.1.2)

randomMovePlayer: Player that picks a random move

Description

Internally this player calls getMoves and then picks an entry in the list of moves at random.

A player is a function that takes a game state as input and returns a valid move index.

Usage

randomMovePlayer(gameState)

Arguments

gameState
The gameState that the player should act on.

Value

moveIndex Index to a valid move as returned by the getMoves function.

Examples

Run this code
gameState <- startGame()
move <- randomMovePlayer(gameState)

Run the code above in your browser using DataLab