Learn R Programming

fourinarow (version 0.1.1)

humanPlayer: Human player

Description

Get moves as input from the command line, allowing users to play against a bot.

Usage

humanPlayer(game)

Value

Prints the current game board and prompts the user to input a move, which must be an integer between 1 and 7 and a valid move in the current game.

Arguments

game

A 6x7 matrix object representing the current game board.

Details

While possible, human vs. human games can be confusing because the game switches Xs and Os between turns (so that every player sees their own pieces as X).

Examples

Run this code
if (FALSE) { # interactive()
play4inaRow(humanPlayer, randomBot)
}

Run the code above in your browser using DataLab