gomoku: A classic chessborad game.

Description Usage Arguments Value Note Author(s) References Examples

View source: R/gomoku.R

Description

Play with your friend or play with computer. Players first choose their color (black or white), then choose a position to locate their stones alternatively, with black going first. Player who first has five stones in row (horizontally, vertically or diagonally) wins the game.

Usage

1
gomoku(n = 19)

Arguments

n

numbers of rows and columns in the chessboard. The default value is 19, which is the standard size of a gomoku chessboard.

Value

If you keep playing the game, nothing will be returned; If you close the game by clicking "quit", a table containing all the results will be displayed; if there are no results, a character string "Game Closed, No Record" will return.

Note

(1)Do not roll the mouse scroll after the graphic device pops out, or the plots will be messed up. (2)Better not close the graphic device during the game. Close it only after clicking the quit option. (3)The value of n should be larger than 5 so the board can accomadate at least five stones. (4)The value of coden should be an odd number.

Author(s)

Yimo Zhang

References

https://github.com/yihui/fun/blob/master/R/gomoku.R, where the basic idea of this function came from. http://www.sohu.com/a/156507478_466874, where the idea of ploting taiji.png is borrowd.

Examples

1
2
 
gomoku(n = 21)

PHP2560-Statistical-Programming-R/r-package-the-best-team documentation built on May 13, 2019, 10:59 p.m.