2048_functional 中文文档教程
game 2048 library
一个基于函数式编程范例的库创建一个 2048 游戏。
Docs API
addNumberToPlayField
addNumberToPlayField(playField)
添加一个随机数(2 或 4)而不是其中一个空单元格。
initPlayField
initPlayField()
创建一个带有空单元格的新游戏场,并在随机选择的单元格上添加一个随机数(2 或 4)。
movePlayField
movePlayField(playField, direction)
在运动场上向指定方向移动。
isWin
isWin(playField)
检查比赛场地上是否有编号为 2048 的单元格。
isLoss
isLoss(playField)
如果所有单元格都被占用并且无法移动,则玩家被击败。
game 2048 library
A library based in a functional programming paradigm to creates a 2048 game.
Docs API
addNumberToPlayField
addNumberToPlayField(playField)
Adds a random number (2 or 4) instead of one of the empty cells.
initPlayField
initPlayField()
Creates a new playing field with empty cells and adds a random number (2 or 4) on a randomly selected cell.
movePlayField
movePlayField(playField, direction)
Makes a move on the playing field in the specified direction.
isWin
isWin(playField)
Checks if there is a cell with the number 2048 on the playing field.
isLoss
isLoss(playField)
If all cells are occupied and it is impossible to make a move, then the player is defeated.