check_win: Check which positions will win

Description Usage Arguments Value Examples

Description

Check which positions will win

Usage

1
check_win(board, target = 1, n = 4)

Arguments

board

The board matrix

target

Integer: What player id do you want.

n

Integer: Connect-n (usually 4)

Value

A vector of will win flags in each slot

Examples

1
2
3
4
5
6
set.seed(12)
x <- matrix(sample(1:2, size = 24, replace = TRUE), nrow = 4)
x <- apply(x, 2, function(y) {
  i=sample(4, size=1)-1
  y[1:i] <- NA
  y})

dougmet/c4dougbot2000 documentation built on May 15, 2019, 10:43 a.m.