Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ignaciomolinaportoles/ncd--memonear
NCD - Memory game smart contract on Near protocol
https://github.com/ignaciomolinaportoles/ncd--memonear
Last synced: 10 days ago
JSON representation
NCD - Memory game smart contract on Near protocol
- Host: GitHub
- URL: https://github.com/ignaciomolinaportoles/ncd--memonear
- Owner: IgnacioMolinaPortoles
- Created: 2022-03-10T15:06:23.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-03-18T18:34:01.000Z (almost 3 years ago)
- Last Synced: 2024-11-07T13:12:19.377Z (2 months ago)
- Language: TypeScript
- Homepage:
- Size: 40 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NCD Project Memonear
🎬 [Loom demo](https://www.loom.com/share/6f72b278a5fa4dbe8ba460a530bb06a7)
🎨 [Figma design](https://www.figma.com/file/CysKjUzYeDr2qUTBw5UohU/Memonear?node-id=0%3A1)
## Install dependencies
```
yarn
```## Build and Deploy the contract
```
yarn buildnear dev-deploy ./build/debug/singleton.wasm
# Save the contract dev name ()
```## Guide
1. You need to create a new game with `createGame` function and send 1 near tokens
2. Player can start playing by checking different combinations, sending the position (x, y) to `checkCombination` of the 2 items to match. To add some difficulty to the game, when 2 items don't match, it won't tell you what items they are.
5. The player need to match all 6 items to win
4. The player can view the board at any moment by using `printBoard(gameId)`
6. If some player doesn't want to play anymore, the owner can call `mockGame` and finish the game
7. When 6 items are matched, the attached deposit when the game was created will be transferred to the wallet of the winner if the player completes the game in less than 8 plays, otherwise it will receive 0.5 near tokens.## Run the game
**Create a game**
```
# Save the game id to playnear call createGame --account_id --amount 1
```**View board for the first time**
```
near call printBoard '{"gameId": }' --account_id
```**Start matching items**
```
near call checkCombination '{"gameId": , "x1": , "y1":, "x2":, "y2":}' --accountId
```## Owner functions
**Get game info (playerId, Game state, Game deposit, Game board, Match count and User tries)**
```
near call getGameInfo '{"gameId": }' --account_id
```
**Hardcode game board to have only 2 items left to match**
```
near call mockGame '{"gameId": , "userPlays": }' --account_id
```