Observed since 20 Oct, 18:55 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
`2048-ts-engine` handles logic for 2048 game. Despite being written in Typescript, you can also use plain JS, if TS is not needed.
2048-ts-engine handles logic for 2048 game. Despite being written in Typescript, you can also use plain JS, if TS is not needed.
yarn add 2048-ts-engine
startGame - simply starting the gamemove
direction: Direction
game: Game
Both these functions return all game related data (board coordinates, score, status etc.) which look like this:
{
"score": 16,
"board": [
[ 0, 0, 4, 0 ],
[ 0, 0, 0, 0 ],
[ 2, 0, 0, 0 ],
[ 4, 8, 0, 8 ]
],
"gameStatus": "STARTED"
}
You will need to store the current state somewhere, since the engine only processes the game, and after every move, the current state of game is returned.
import { startGame, move } from '2048-ts-engine';
import { Direction, Game, GameStatus } from '2048-ts-engine/src/types';
const newGame = startGame();
const gameProcessed = move(Direction.UP, newGame);
# test game logic
yarn test
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 1.4.5Registry latest | 3 Apr 2022 | 5 | |
| 1.4.4 | 3 Apr 2022 | 3 | |
| 1.4.3 | 3 Apr 2022 | 3 | |
| 1.4.2 | 3 Apr 2022 | 3 | |
| 1.4.1 | 3 Apr 2022 | 3 | |
| 1.4.0 | 3 Apr 2022 | 3 | |
| 1.3.2 | 3 Apr 2022 | 3 | |
| 1.3.1 | 3 Apr 2022 | 3 | |
| 1.3.0 | 3 Apr 2022 | 3 | |
| 1.2.6 | 3 Apr 2022 | 3 | |
| 1.1.6 | 1 May 2021 | 3 | |
| 1.1.5 | 1 May 2021 | 3 | |
| 1.1.4 | 1 May 2021 | 3 | |
| 1.1.3 | 1 May 2021 | 3 | |
| 1.1.2 | 1 May 2021 | 3 | |
| 1.1.1 | 1 May 2021 | 3 | |
| 1.1.0 | 1 May 2021 | 3 | |
| 1.0.1 | 12 Mar 2021 | 0 | |
| 1.0.0 | 12 Mar 2021 | 0 |
This describes our collected data; it is not a security assessment.
Shared repository data · GitHub
Observed since 20 Oct, 18:55 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:0754772dcd74b577422deeef10acb85f53f8ff566f79c03864081dba9375ccd2