Skip to content

Instantly share code, notes, and snippets.

@alcuin
alcuin / othello
Created December 30, 2013 06:41
A Min-Max search algorithm for Othello on R with simple GUI.
CONST.TIME.LIMIT <- 6 # threshold of time(sec) for searching.
CONST.MAX.DEPTH <- 3 # max depth of depth-first searching.
##' main
othello <- function(verbose = FALSE) {
## initialize.
board <- as.numeric(rep(0,8^2))
turn <- 1
board[conv.xy2index(4,4)] <- board[conv.xy2index(5,5)] <- 1
board[conv.xy2index(4,5)] <- board[conv.xy2index(5,4)] <- -1