Learn R Programming

tictactoe (version 0.2.2)

xhash: Create Hash Table for Generic Keys

Description

Create Hash Table for Generic Keys

Usage

xhash(convfunc = function(state, ...) state, convfunc_vec = function(states,
  ...) unlist(Map(convfunc, states, ...)), default_value = NULL)

Arguments

convfunc
function that converts a game state to a key. It must take a positional argument state and keyword arguments represented by ..., and returns a character.
convfunc_vec
function for vectorized conversion from states to keys. This function must receive a positional argument states and keyword arguments ... and returns character vector. By default, it tries to vectorize convfunc using Map. User may specify more efficient function if any.
default_value
value to be returned when a state is not recorded in the table.

Value

xhash object